我正在使用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的初学者。
发布于 2012-07-06 19:18:21
它实际上低于这个值:
https://github.com/aino/galleria/blob/master/src/galleria.js#L5687
$.data( this, 'galleria', new Galleria().init( this, options ) );https://stackoverflow.com/questions/11195826
复制相似问题