jQuery UI Dialog cause page jump on open & close on ASP.NET

时间:2022-02-15 05:37:32

I have an ASP.NET C# page, with image thumbnails in it.
I created a script that opens a jQuery UI Dialog on each hover on a thumbnail that shows me the thumbnail in larger size in a dialog view, and when I hover out - dialog closes.
My little annoying problem is, that in every mouseover (trigger dialog to open) - the page makes itself 'longer' - a scrollbar appears on the side of the browser, and it seems like the page gets longer when a dialog is openning, but it shouldn't do so.
When I hover off (mouseout) - the dialog disappears and the page returns to its normal state.
Because of this- when I hover through the thumbnails, my page 'jumps'.
I looked for a solution for this, and I've added return false; for each dialog open, and close - and it still doesn't make any different.
Sorry for the unperfect english, and thanks for all helpers!

我有一个ASP.NET C#页面,里面有图像缩略图。我创建了一个脚本,在每个鼠标悬停在缩略图上打开一个jQuery UI对话框,在对话框视图中显示更大尺寸的缩略图,当我悬停时 - 对话框关闭。我的小麻烦问题是,在每次鼠标悬停(打开触发器对话框)时 - 页面使自己“更长” - 浏览器侧面会出现一个滚动条,当对话框打开时,页面似乎变得更长,但是它不应该这样做。当我悬停(mouseout)时 - 对话框消失,页面返回正常状态。因此,当我将鼠标悬停在缩略图上时,我的页面会“跳跃”。我为此找了一个解决方案,并且我添加了return false;每个对话框打开,关闭 - 它仍然没有任何不同。抱歉英语不完美,感谢所有帮助!

1 个解决方案

#1


3  

I finally got my solution - for all interested:

我终于得到了我的解决方案 - 感兴趣的是:

open: function(event, ui){  
   /*  
    * Scrollbar fix   
    */  
   $('body').css('overflow','hidden');  
} 

I added this to dialog's opening event and it fixed the issue!

我将此添加到对话框的开幕活动中,它解决了问题!

#1


3  

I finally got my solution - for all interested:

我终于得到了我的解决方案 - 感兴趣的是:

open: function(event, ui){  
   /*  
    * Scrollbar fix   
    */  
   $('body').css('overflow','hidden');  
} 

I added this to dialog's opening event and it fixed the issue!

我将此添加到对话框的开幕活动中,它解决了问题!