0

My website uses Fancybox to display item and mousewheel for horizontal mouse scroll.

Each time I scroll my page, then select an item, the horizontal scroll is set to position 0. I want the scroll remains its position.

Please help me.

4

2 回答 2

0

Fancybox 正在 html 上设置 .fancybox-lock 类...

.fancybox-lock {
    overflow: hidden !important; // <-- this is the problem
    width: auto;
}

.fancybox-lock {
    width: auto;
}
于 2013-09-26T09:26:56.217 回答
0

我编辑了你的代码并且它的工作。

  • 加载前:

  • 关闭前:

  • 展后:

这是没有必要的。我删除了。

       var scrollPos = 0;
        $(".news_helper").fancybox({
            width: 512,
            fitToView: false,
            height: '100%',
            autoSize: false,
            closeClick: false,
            openEffect: 'none',
            closeEffect: 'none',
            mouseWheel: false,
        });
        $('html, body').mousewheel(function (event, delta, deltaX, deltaY) {
            this.scrollLeft -= (delta * 100);
            event.preventDefault();
        });
        $("img.lazy").lazyload({
            effect: "fadeIn",

        });

检查它JSFIDDLE

于 2013-09-26T10:25:04.887 回答