我在某些页面中有一个插件,但在其他一些页面中我不想要它,所以我没有引用它的脚本文件。
如何在使用前检查插件功能是否存在。
就我而言,我正在使用这个插件:我像这样使用它:
$('#marquee-inner div').marquee('pointer').mouseover(function() {
$(this).trigger('stop');
}).mouseout(function() {
$(this).trigger('start');
}).mousemove(function(event) {
if ($(this).data('drag') == true) {
this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
}
}).mousedown(function(event) {
$(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
}).mouseup(function() {
$(this).data('drag', false);
});
我想要的是在调用这个选框函数之前检查它是否存在。