Reputation: 2078
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.
Upvotes: 0
Views: 344
Reputation: 7053
Looks to me as if you can access them through the first param:
opts.loading.start.call($(opts.contentSelector)[0],opts);
So you'd do:
start: function (opts) { console.log(opts); }
I've not used this plugin before so I've not tried this myself.
Upvotes: 1