【问题标题】:Galleria Using JqueryGalleria 使用 Jquery
【发布时间】:2012-07-06 19:18:21
【问题描述】:

我正在使用 Galleria jQuery 插件(可在此地址找到:http://galleria.io/),我想知道是否有人可以在创建初始“Galleria”实例的代码中向我指出。我知道有一个 Galleria 类和构造函数,但我找不到/不明白初始实例的制作位置。

我怀疑它可能在这里的某个地方:

$.fn.galleria = function( options ) {

var selector = this.selector;

// try domReady if element not found
if ( !$(this).length ) {

    $(function() {
        if ( $( selector ).length ) {

            // if found on domReady, go ahead
            $( selector ).galleria( options );

        } else {

            // if not, try fetching the element for 5 secs, then raise a warning.
            Galleria.utils.wait({
                until: function() {
                    return $( selector ).length;
                },
                success: function() {
                    $( selector ).galleria( options );
                },
                error: function() {
                    Galleria.raise('Init failed: Galleria could not find the element "'+selector+'".');
                },
                timeout: 5000
            });

        }
    });
    return this;
}

return this.each(function() {

    // fail silent if already run
    if ( !$.data(this, 'galleria') ) {
        $.data( this, 'galleria', new Galleria().init( this, options ) );
    }
});

};

非常感谢您的帮助。我是 jQuery 和 Javascript 的初学者。

【问题讨论】:

    标签: jquery galleria


    【解决方案1】:

    其实在下面:

    https://github.com/aino/galleria/blob/master/src/galleria.js#L5687

    $.data( this, 'galleria', new Galleria().init( this, options ) );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多