我使用的是colorbox jquery lightbox。
当模式使用打开时,我当前禁用了主窗口滚动
$(document).bind('cbox_open', function () {
$('html').css({ overflow: 'hidden' });
}).bind('cbox_closed', function () {
$.colorbox.remove();
$('html').css({ overflow: 'auto' });
});
但我认为这还不够好。
我希望它能在模态打开时将滚动从模态转移到主窗口
例如,类似bootstrap模式3:http://jsfiddle.net/NUCgp/183/
如有任何帮助,我们将不胜感激。
您尝试过将滚动选项设置为false吗?
If false, Colorbox will hide scrollbars for overflowing content. This could be used on conjunction with the resize method (see below) for a smoother transition if you are appending content to an already open instance of Colorbox.
从这里:http://www.jacklmoore.com/colorbox/
API还有一个调整大小的功能。如果你有动态内容,你可以将窗口调整为内容的大小,这不会导致灯箱内的任何滚动。