Swipebox hideBarsDelay无法正常工作和动态图库选项

时间:2015-04-29 18:35:57

标签: jquery mobile gallery lightbox

我试图用文档中给出的选项停止隐藏条形图和标题,但它们仍然消失,有人修复此问题吗?也无法弄清楚如何在动态加载的图库中使用这些选项,我的代码是:

我用它来启动画廊:

<a id="smPilotos1" title="Casino Plaza - Piloto Classic"><img src="htt://www.llanoriente.cl/img/galeria/llano-oriente-11-tn.jpg" class="th radius" alt="Casino Plaza - Piloto Classic"></a>

我用它来解雇画廊:

    $( document ).ready(function() {

  /* Basic Gallery */
  $( '.swipebox' ).swipebox({
    useCSS : true, // false will force the use of jQuery for animations
    hideBarsDelay : 0 // 0 to always show caption and action bar
  });


  /* Dynamic Gallery */
  $( '#smPilotos1' ).click( function( e ) {
    e.preventDefault();
    $.swipebox( [
    { href:'img/galeria/llano-oriente-11-big.jpg', title:'Loop Wall Depto. 1D 1B' },
    { href:'img/galeria/llano-oriente-12-big.jpg', title:'Living Comedor Depto. 1D 1B' },
    { href:'img/galeria/llano-oriente-13-big.jpg', title:'Dormitorio en Suite Depto. 1D 1B' },
    ] ); 
  } );

  });

1 个答案:

答案 0 :(得分:1)

这让我有点难过。文档不涉及为动态库设置默认值,但源代码显示了答案:

$.swipebox = function( elem, options ) { ...

因此,您必须传递幻灯片数组,然后传递任何默认覆盖的对象。您的代码应如下所示:

/* Dynamic Gallery */
$( '#smPilotos1' ).click( function( e ) {
    e.preventDefault();
    $.swipebox(
        [
            { href:'img/galeria/llano-oriente-11-big.jpg', title:'Loop Wall Depto. 1D 1B' },
            { href:'img/galeria/llano-oriente-12-big.jpg', title:'Living Comedor Depto. 1D 1B' },
            { href:'img/galeria/llano-oriente-13-big.jpg', title:'Dormitorio en Suite Depto. 1D 1B' },
        ],
        {
            useCSS : true, // false will force the use of jQuery for animations
            hideBarsDelay : 0 // 0 to always show caption and action bar
        }    
    ); 
} );