jQuery模式对话框禁用滚动条
正如您在此链接上看到的那样, http://jsbin.com/ozapol/9 ,
As you can see on this link, http://jsbin.com/ozapol/9 ,
jQuery会禁用某些版本的IE和最新版本的chrome上的滚动条. (我还没有尝试过其他任何方法...)
Jquery disables the scrollbars on some versions of IE and the latest version of chrome. (I didnt try any other yet...)
有没有一种方法可以使滚动条保持启用状态,从而可以滚动显示较长的对话框?
Is there a way to keep scrollbars enabled to be able to scroll through a long long dialog ?
谢谢! 再见
适用于Internet Explorer的不错的解决方案(感谢jk.)
html {overflow-y : scroll}
Chrome的残酷解决方法(感谢jk.)
在Chrome上,JqueryUI劫持了滚动条上的鼠标事件. 看起来像上面链接中提到的错误. 为了删除这些绑定,您必须取消绑定事件 每次创建模式对话框时:
On Chrome, JqueryUI Hijacks mouse events on the scrollbars. This looks like a bug that is referred in the links above. In order to remove those bindings, you have to unbind events each time you create a modal dialog :
$("#longdialog").dialog({
open: function(event, ui) {
window.setTimeout(function() {
jQuery(document).unbind('mousedown.dialog-overlay')
.unbind('mouseup.dialog-overlay');
}, 100);
},
modal:true
});
有最后一个示例: http://jsbin.com/ujagov/2
指向错误报告的链接:
- http://bugs.jqueryui.com/ticket/4671
- http://wiki.jqueryui.com/w/page/34725121/Visual-Test-Page-Cleanup
- http://bugs.jqueryui.com/ticket/4671
- http://wiki.jqueryui.com/w/page/34725121/Visual-Test-Page-Cleanup
您可以通过以下方式使滚动条保持启用状态:
You can keep scrollbars enabled with:
html {overflow-y: scroll;}
您可以通过编程方式添加该CSS,因此它不会影响网站的每个页面以及设计.
You could add that CSS programmatically so it doesn't affect every page of the site and possibly the design.
而且,您可能必须取消绑定模式对话框劫持的鼠标事件:
And, you may have to unbind the mouse events that the modal dialog hijacks:
$("#longdialog").dialog({
open: function(event, ui) {
window.setTimeout(function() {
jQuery(document).unbind('mousedown.dialog-overlay')
.unbind('mouseup.dialog-overlay');
}, 100);
},
modal:true
});