有没有办法在您选择一个时阻止 Fancybox 缩略图移动? 目前,每次您单击缩略图时,它都会重新定位缩略图行。
此行为可以在“扩展功能 - 缩略图助手”部分下看到:http://fancyapps.com/fancybox/
我只是希望整个缩略图行居中且静态。
最佳答案
为了使用缩略图助手,您还必须加载以下 JS 文件:
<script type="text/javascript" src="/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=2.1.4"></script>
底部附近是以下代码:
//Center list
onUpdate: function (opts, obj) {
if (this.list) {
this.list.stop(true).animate({
'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))
}, 150);
}
},
将其更改为:
//Center list
onUpdate: function (opts, obj) {
/* if (this.list) {
this.list.stop(true).animate({
'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))
}, 150);
} */
},
这应该会阻止它产生动画。我还没有测试它,因为我没有安装它,但通过阅读代码,我认为这就是移动缩略图的原因。尝试一下,让我知道它是否有效。
关于javascript - 防止 Fancybox 缩略图四处移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14911568/