Question

It seems like reloading infobox inside ajax success function is trying to position infobox somewhere else, in firebug I can see it changes its top to something else. If earlier its top: -12.4635px; then when I use

lastInfoWindow.setOptions({"content":"its content here"});

then it becomes -4.46351px; when I click on next or previous button on infobox, next and previous buttons calls ajax to change its content dynamically

where previously intialised lastInfoWindow is like this:

> var myOptions = {
>           boxClass: "popup infoBox",
>           content:boxText,
>           disableAutoPan:true,
>           maxWidth:0,
>           pixelOffset: new google.maps.Size(-(ib_width/2), 0),
>           zIndex: null,
>           boxStyle: {
>             background: "none",
>             opacity: 1,
>             width: ib_width+"px"
>           },
>           closeBoxMargin: "0px 0px 0px 0px",
>           closeBoxURL: "/" + version_link + "/images/popup_close.png",
>           infoBoxClearance: new google.maps.Size(1, 1),
>           isHidden: false,
>           pane: "floatPane",
>           enableEventPropagation: false,
>           marginBottom:mb,
>           marginLeft:ml,
>           grouped:group
>         };
>         var infoWindow = new InfoBox(myOptions);
>         lastInfoWindow = infoWindow;

I tried fetching current top position in some variable and then after ajax done function i tried changing its top to already saved position, but it didn't work, I used setTimeout to delay it but still it isn't working. What else I can do now.

Was it helpful?

Solution

Modified Infobox js file

InfoBox.prototype.rePosition = function () {
    if(cM_contentCurrentPos){
          this.div_.style.top = cM_contentCurrentPos;
    }
}

where cM_contentCurrentPos contains previous top position. I called it like this

infoWindow.rePosition();
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top