0

我正在使用 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 的初学者。

4

1 回答 1

0

它实际上低于:

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

$.data( this, 'galleria', new Galleria().init( this, options ) );
于 2012-07-06T11:18:21.440 回答