fancybox-fancybox聚焦时如何滚动页面 [英] fancybox - how to scroll page when fancybox is focused

查看:77
本文介绍了fancybox-fancybox聚焦时如何滚动页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

转到: http://fancybox.net/ 打开任何示例(在底部页面上)

go to: http://fancybox.net/ open any example (on bottom page)

当鼠标悬停在fancybox内的内容上时,浏览器主窗口无法滚动.当鼠标在其他任何地方时,它将起作用.我不想要这种行为.您将如何解决?

when the mouse is hovered over the content inside the fancybox, the browser main window can´t be scrolled. when the mouse is anywhere else it works. i dont want this behavior. how would you fix this?

当鼠标光标位于fancyboxmodal中时,fancybox modal doenst滚动下的页面.

the page under the fancybox modal doenst scroll, when the mousecursor is inside the fancyboxmodal.

推荐答案

查看Fancybox的源代码,并用以下内容替换if ($.fn.mousewheel) {...}标记的代码(完整修改的代码可以找到

Look in the source code of Fancybox, and replace the code marked by if ($.fn.mousewheel) {...} with the following (The fullly modified code can be found here).

    if ($.fn.mousewheel) {
        wrap.bind('mousewheel.fb', function(e, delta) {
            if (!busy && $(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
                // Remove the next line too, if you want weird movements
                // at the image gallery example...
                e.preventDefault();
                $.fancybox[ delta > 0 ? 'prev' : 'next']();
            }
        });
    }

Fancybox的创建者禁用了Fancybox元素上的滚动,而未添加自定义此选项.因此,您必须手动编辑代码.

The creators of Fancybox disabled scrolling on Fancybox elements, without adding an option to customise this. Hence you have to manually edit the code.

这篇关于fancybox-fancybox聚焦时如何滚动页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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