Fancybox 1.3.X忽略宽度和高度参数

Fancybox 1.3.x ignores width and height parameters

本文关键字:高度 参数 Fancybox      更新时间:2023-09-26

我使用的是Fancybox 1.3.4(目前最新的),我使用以下HTML元素:

<a href="LARGE_URL" title="FANCY_CAPTION" rel="gallery" class="gallery-item">
  <img src="SMALL_URL"/> 
</a> 
<a> ... repeat N times... </a>
然后我使用以下jQuery代码:
<script>
  $(document).ready(function() {
    $('a.gallery-item').fancybox({
        'autoDimensions': 'false',
        'width':900,
        'height':'auto',
        'cyclic': true,
        'centerOnScroll': 'false',
        'hideOnOverlayClick': true,
        'hideOnContentClick': false,
        'overlayShow': true,
        'overlayOpacity': 0.7,
        'overlayColor': '#666',
        'titleShow': true,
        'titlePosition': 'inside',
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 400,
        'speedOut': 200,
        'showCloseButton': true,
        'showNavArrows': true,
        'enableEscapeButton': true
    });
  });        
</script>

我也试过

    'width':'900',

或同时设置

    'width':900,
    'height':600,

但它就是不工作

有解决方案吗?

我需要#fancybox-wrapper元素有一个精确的大小

尝试去掉false周围的引号:

'autoDimensions': false