Ссылка на параметры плагина jQuery - PullRequest
0 голосов
/ 13 января 2012

Я использую плагин inifiteScroll jquery и хочу сослаться на переменную options из моей версии функции 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;
            }
        });

Как я могу ссылаться на опции плагина внутрифункция запуска?

Цените помощь, Yehia.

1 Ответ

1 голос
/ 13 января 2012

Мне кажется, что вы можете получить к ним доступ через первый параметр:

opts.loading.start.call($(opts.contentSelector)[0],opts);

Итак, вы бы сделали:

start: function (opts) { console.log(opts);  }

Я не использовал этот плагин раньше, поэтому я сам не пробовал.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...