如何访问某个jQuery扩展函数?
问题描述:
这是我使用的幻灯片插件的代码。我试图根据按下的按钮跳转到特定的幻灯片。如何访问某个jQuery扩展函数?
如何使用参数“2”访问'跳转'功能?
$.extend($.fn.cycletwo, c2);
$.extend(c2.API, {
next: function() {
var opts = this.opts();
if (opts.busy && ! opts.manualTrump)
return;
var count = opts.reverse ? -1 : 1;
if (opts.allowWrap === false && (opts.currSlide + count) >= opts.slideCount)
return;
opts.API.advanceSlide(count);
opts.API.trigger('cycletwo-next', [ opts ]).log('cycletwo-next');
},
jump: function(index) {
// go to the requested slide
var fwd;
var opts = this.opts();
if (opts.busy && ! opts.manualTrump)
return;
var num = parseInt(index, 10);
if (isNaN(num) || num < 0 || num >= opts.slides.length) {
opts.API.log('goto: invalid slide index: ' + num);
return;
}
if (num == opts.currSlide) {
opts.API.log('goto: skipping, already on slide', num);
return;
}
opts.nextSlide = num;
clearTimeout(opts.timeoutId);
opts.timeoutId = 0;
opts.API.log('goto: ', num, ' (zero-index)');
fwd = opts.currSlide < opts.nextSlide;
opts.API.prepareTx(true, fwd);
},
opts.API.updateView();
}
}
});
答
跳跃是一个键,该功能是用于跳跃 的值跳跃关键是在对象,如滑动您可以访问到 例如合同:slide.jump()
答
说slide
是$(...)返回的包裹的DOM对象,那么你可以尝试
slide.cycletwo.API.jump(2);
何不˚F使用浏览器指出它developer tools > Console
这是$ .extend将我扔掉。 关注的页面是[这里](http://www.dolphinent.com/wp/products)。 – user3473640