Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在显示弹出图像的画廊中使用 fancybox 2.1.4。根据默认设置,fancybox 中包含弹出图像的框的位置,将出现固定到屏幕窗口。是否可以使弹出图像框出现固定到 html 页面,而不是屏幕?在哪里修改此弹出位置行为?是在 jquery.fancybox.js 还是 jquery.fancybox.css 中?因为我似乎找不到使其默认修复屏幕的“修复”规则。
您必须设置 fancybox API 选项autoCenter并locked喜欢false:
autoCenter
locked
false
$(function () { $(".fancybox").fancybox({ autoCenter: false, helpers: { overlay: { locked: false } } }); });
在哪里?在您自己的自定义 fancybox 脚本中;无需弄乱原始文件。
见JSFIDDLE