jQuery模式对话框禁用滚动条 [英] Jquery modal dialogs DISABLE the scrollbars

查看:158
本文介绍了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

指向错误报告的链接:

  1. http://bugs.jqueryui.com/ticket/4671
  2. http://wiki.jqueryui.com/w/page/34725121/Visual-Test-Page-Cleanup
  1. http://bugs.jqueryui.com/ticket/4671
  2. 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
});

请参阅在Chrome中使用jQuery UI对话框的滚动条问题和Safari

这篇关于jQuery模式对话框禁用滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆