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.
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.
Fancybox 正在 html 上设置 .fancybox-lock 类...
.fancybox-lock {
overflow: hidden !important; // <-- this is the problem
width: auto;
}
.fancybox-lock {
width: auto;
}
我编辑了你的代码并且它的工作。
加载前:
关闭前:
展后:
这是没有必要的。我删除了。
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