DhtmlXWindow Centering after scroll

Hi,



I have a problem with the dhtmlxwindow when I open a window after a scroll down, the window doesn’t open from the center of the current position.



Does anyone has the same problem or any solution?



Thanks

Hello,



Window centers in viewport, so it seems your viewport is scrolled or something else.

Could you please provide a demo to reproduce the issue?

Hi,

I found a solution for my problem.
Actually I’m not using the viewport in my issue,

[content]



    var dhtmlXWindow = new dhtmlXWindows();

    dhtmlXWindow.setImagePath("/js/dhtmlX/dhtmlXWindows-2.0/imgs/");
    dhtmlXWindow.attachEvent(“onHide”, function( windowObj ) {
        windowObj.setModal( false );
    });
           
    dhtmlXWindow.attachEvent(“onShow”, function( windowObj ) {

        windowObj.center();
        windowObj.setModal( true );
        windowObj.bringToTop();;
        var topPosition = (window.innerHeight/2-windowObj.getHeight()/2)+document.body.scrollTop;
        windowObj.setPosition(windowObj.getPosition()[0], topPosition);
       
        divModalCollection    = document.getElementsByClassName(“dhx_modal_cover_dv”);
        divModal              = divModalCollection[0];

        innerHeight           = window.innerHeight
        offsetHeight          = document.body.offsetHeight
        divModal.style.height = (innerHeight>offsetHeight?innerHeight:offsetHeight);
    });
               
    windowNameShow = function( func, event ){ if(func!=undefined) func(); showDiv(“windowNameDiv”);windowName.show(); }
    windowNameHide = function(){ windowName.hide(); }

That way, every time window is opened, the “onShow” function calculates the page scroll and reposition the window on center.
I’ve been testing this in IE and Firefox and it’s working well.