私は 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の初心者です。