0
私はinifiteScrollのjQueryプラグインを使用している、と私はlocading.start機能の私のバージョンからの変数のオプションを参照したい:リファレンスjQueryプラグインオプション
var rDealBone = this;
($('.deals-list'), this.el).infinitescroll({
navSelector : "div.navigation",
nextSelector : "div.navigation a",
itemSelector : ".deal",
debug: true,
loading: {
finished: undefined,
finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
img: "http://www.infinite-scroll.com/loading.gif",
msg: null,
msgText: "<em>Loading the next set of posts...</em>",
selector: null,
speed: 'fast',
start: function(){
// this is the code from the default start function of the plugin,
// the opts refers to the plugin options cariable, how can i refere to it
// from this function
$(opts.navSelector).hide();
opts.loading.msg
.appendTo(opts.loading.selector)
.show(opts.loading.speed, function() {
rDealBone.showMore();
});
}
},
pathParse: function(){
return '/listDeals/offset:' + rDealBone.doffset;
}
});
にはどうすればいいからプラグインオプションに参照することができますスタート機能の中で?
ヘルプ、Yehiaを歓迎します。あなたが最初のパラメータを介してそれらにアクセスすることができているかのよう
ありがとうございます。また、無限小文字の_error関数を呼びたい場合は、$ .infinitescroll._error( "end")は動作しません。 –
残念ながら、アンダースコアの先頭にはプライベートなものがありますので、しかし、私はそれを次のように実行することはお勧めできませんが、 'public'インターフェースを介して実行してください: '$( '。deals-list')data( 'infinitescroll')._ error( 'end');' githubで問題を開いて、_errorメソッドを実行する正当な理由がある場合は、そのメソッドを公開することができます。 – riscarrott
また、public関数(接頭辞がアンダースコアでないもの)を呼び出す場合は、 '$( '。deals-list')。infinitescroll( 'methodName'、arg1、arg2など)のように呼び出す必要があります。 。); '$ .infinitescroll'には直接はなく、実際にはコンストラクタ関数です。 (通常は '$ .Infinitescroll'と呼ばれることがあります) – riscarrott