我正在做一个水平滚动的网站。在它上面,我使用了mousewheel.js插件(允许使用鼠标滚轮进行水平滚动)和magnific插件。
当有人通过点击一张照片来激活magnific popup插件时,它会像往常一样打开照片,背景滚动条也会被禁用。
但是,由于我使用的是mousewheel.js,背景仍然可以用鼠标滚轮滚动。
如何才能禁用背景滚动,只有当magnific显示照片时?
发布于 2018-06-01 06:08:22
我也有类似的问题。这个决定在一定程度上帮助了我。
$('#open_button').magnificPopup({
type: 'inline', // Custom settings, never mind
closeBtnInside: false, // Custom settings, never mind
fixedContentPos: false, // Custom settings, never mind
fixedBgPos: true, // Custom settings, never mind
callbacks: {
open: function() { // When you open the
$('body').css('overflow', 'hidden'); // window, the element
}, // "body" is used "overflow: hidden".
close: function() { // When the window
$('body').css('overflow', ''); // is closed, the
}, // "overflow" gets the initial value.
}
});
https://stackoverflow.com/questions/28229337
复制相似问题