【发布时间】:2015-01-30 04:40:43
【问题描述】:
我正在开发一个水平滚动网站。 在它上面,我使用了 mousewheel.js 插件(允许使用鼠标滚轮进行水平滚动)和 magnific-popup 插件。
当有人通过单击照片激活放大弹出插件时,它会按原样打开照片,并且背景滚动条被禁用。
但是,由于我使用的是 mousewheel.js,背景仍然可以通过鼠标滚轮滚动。
只有在 magnific-popup 显示照片时才能禁用背景滚动?
【问题讨论】:
我正在开发一个水平滚动网站。 在它上面,我使用了 mousewheel.js 插件(允许使用鼠标滚轮进行水平滚动)和 magnific-popup 插件。
当有人通过单击照片激活放大弹出插件时,它会按原样打开照片,并且背景滚动条被禁用。
但是,由于我使用的是 mousewheel.js,背景仍然可以通过鼠标滚轮滚动。
只有在 magnific-popup 显示照片时才能禁用背景滚动?
【问题讨论】:
我也有类似的问题。这个决定在一定程度上帮助了我。
$('#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.
}
});
【讨论】: