0

I am using the Galleria jQuery plugin (found at this address: http://galleria.io/), and I was wondering if someone could point out to me in the code where the initial "Galleria" instance is created. I understand that there is a Galleria class and constructor, but I can't find/don't understand where the initial instance is made.

I suspect it may be somewhere here:

$.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 ) );
    }
});

};

Thank you so much for your help. I am a beginner with jQuery and Javascript.

voltair
  • 615
  • 2
  • 7
  • 21

1 Answers1

0

It’s actually below that:

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

$.data( this, 'galleria', new Galleria().init( this, options ) );
David Hellsing
  • 106,495
  • 44
  • 176
  • 212