由于固定导航,在扇形框的顶部和底部添加边距

Adding margin to top and bottom of fancybox due to fixed navigation

本文关键字:顶部 底部 添加 导航 于固定      更新时间:2023-09-26

我在我的fancybox图像的顶部和底部添加了一个边距,因为我在页面顶部有一个固定的导航栏,使用我在这个问题中找到的代码。我已经把这个添加到我的jQuery中,就像它说的那样:

<script type="text/javascript">
    $("a.fancybox").fancybox({
    margin: [120, 60, 50, 60] // top, right, bottom, left
});</script>

下方:

<script type="text/javascript">
    $(document).ready(function() {
    $("a.fancybox").fancybox({
        'transitionIn'  :   'fade',
        'transitionOut' :   'fade',
        'speedIn'       :   600, 
        'speedOut'      :   200, 
        'overlayShow'   :   true
    }); 
    });
    </script>

问题是,当点击一个图像时,它会按照我想要的方式工作(位于导航的顶部),但在图像中导航时,下一个高(纵向)的图像会再次位于导航的后面。我试过增加上边距值,但没有任何变化。

这是一个带有fancybox的页面:http://pacificdesignacademy.com/gallerygd.php

我是不是做错了什么?任何建议都将不胜感激。谢谢

更改此

<script type="text/javascript">
    $(document).ready(function() {
    $("a.fancybox").fancybox({
        'transitionIn'  :   'fade',
        'transitionOut' :   'fade',
        'speedIn'       :   600, 
        'speedOut'      :   200, 
        'overlayShow'   :   true
    }); 
    });
    </script>
    <script type="text/javascript">
    $("a.fancybox").fancybox({
    margin: [120, 60, 50, 60] // top, right, bottom, left
});</script>

通过这个

<script type="text/javascript">
$(document).ready(function () {
    $("a.fancybox").fancybox({
        'transitionIn': 'fade',
         'transitionOut': 'fade',
         'speedIn': 600,
         'speedOut': 200,
         'overlayShow': true,
         margin: [120, 60, 50, 60] // top, right, bottom, left
    });
});
</script>

注意:您的API选项已过时(v1.3.4)请检查文档中使用版本的正确选项