很抱歉缺少代码,但基本上我正在使用jqModal插件,它工作得很好,正如预期的那样,然而我只是提出了一个关于它的问题,并希望有人能说明我是如何解决我的问题的。
基本上,我的弹出窗口是100%的宽度和高度的浏览器,但是浏览器滚动条仍然反映了我的原始网页的高度,而不是jqModal,有什么想法,我可以改变这一点吗?谢谢!
发布于 2012-09-12 22:35:01
谢谢你的意见,Murali,但我找到了另一种方法来解决它。基本上,我决定在触发弹出窗口时隐藏body滚动条,然后在popup div中添加一个滚动条。在关闭弹出窗口时,我重新应用body滚动条,这是一种享受。感谢您抽出时间查看并回答我的问题。:)
发布于 2012-09-12 19:39:41
在打开对话框时更改滚动位置将解决您的问题
$('dailog-div').dialog(
autoOpen: false,
open: function () {
var scrollPosition = [self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop];
var html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that
html.data('scroll-position', scrollPosition);
html.data('previous-overflow', html.css('overflow'));
html.css('overflow', 'hidden');
window.scrollTo(scrollPosition[0], scrollPosition[1]);
},
close: function () {
var html = jQuery('html');
var scrollPosition = html.data('scroll-position');
html.css('overflow', html.data('previous-overflow'));
window.scrollTo(scrollPosition[0], scrollPosition[1]);
$(this).dialog('destroy').remove();
}
}).dialog('open'); https://stackoverflow.com/questions/12386464
复制相似问题