0

The problem is when Im scrolling down my page (e.g Yposition = 1500) and reloading my dialogPreview. The srollTop position of the page is changing to the top of the page (there is located dialog).

var yPos = document.documentElement.scrollTop || document.body.scrollTop;
$("#dialogPreview").dialog({
    title : $("#previewTitle").val(),
    resizable : false,
    width : 185,
    height : 240,
    draggable : false,
    dialogClass : "dialogPreviewClass",
    position : {
        my : "left top",
        at : "left bottom",
        of : $("#previewHandler")
    },
    open: function( event, ui ) 
    {
        document.documentElement.scrollTop = yPos;
        alert("test");
    },
    close : onCloseDialog,
    autoOpen : false
});

"open" function is running too fast. How to check if dialog is loaded and change scrollTop position in right moment and place? jquery version 1.10. On 1.9 everything was right.

Niklesh Raut
  • 34,013
  • 16
  • 75
  • 109
jaa
  • 37
  • 6

1 Answers1

0

ok, I fixed it. In first version I made simple onFocus event

focus: function( event, ui ) 
    {
        if(is_chrome){
            document.body.scrollTop = yPos;
        }else{
            document.documentElement.scrollTop = yPos;
        }
    },

where yPos was

var yPos = document.documentElement.scrollTop || document.body.scrollTop;

but my window was fast scrolled up and down. Finally I override function responsible for focusing like here

$.ui.dialog.prototype._focusTabbable = function(){};
Community
  • 1
  • 1
jaa
  • 37
  • 6