参考 jQuery 插件选项
我正在使用 inifiteScroll jquery 插件,并且我想从我的 locading.start 函数版本中引用选项变量:
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;
}
});
How can I reference to the plugin options from inside the start function?
感谢您的帮助,叶希亚。
I'm using the inifiteScroll jquery plugin, and I want to reference the options variable from my version of the locading.start function:
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;
}
});
How can I reference to the plugin options from inside the start function?
Appreciate the help, Yehia.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,好像你可以通过第一个参数访问它们:
所以你会这样做:
我以前没有使用过这个插件,所以我自己没有尝试过。
Looks to me as if you can access them through the first param:
So you'd do:
I've not used this plugin before so I've not tried this myself.