我正在开发一个 jQuery 插件, 其中当我单击暂停链接时, 我需要在插件中调用函数 。 我的代码是这样的
$("#pauseAnimation").click(function () { $.fn.cjImageVideoPreviewer().pauseAnimation(); })
和函数将被调用
(function ($) {
$.fn.cjImageVideoPreviewer = function (options) {
var settings = {
// user editable settings
images: [],
delay: 1000,
autoPlay: false,
showProgress: false
};
var sys = {
// function parameters
version: 1.0.2 ,
elem: null,
idx: 1,
timer: null,
loaded: 0,
mouseX: null,
mouseY: null,
state: false
};
/*
handle transitions
***************************************/
function clearTimer() {
if (sys.timer !== null) {
window.clearTimeout(sys.timer);
sys.timer = null;
}
}
// reset everything
function stopAnimation() {
if (sys.state) {
clearTimer();
sys.idx = 0;
sys.state = false;
// show the first image
$(sys.elem).find("div.cjImageVideoPreviewer img:first").css({
"display": "block"
});
// hide all the other images
$(sys.elem).find("div.cjImageVideoPreviewer img:not(:first)").css({
"display": "none"
});
}
}
// pause
function pauseAnimation() {
if (sys.state) {
clearTimer();
sys.idx = 0;
sys.state = false;
}
}
当我单击链接时,错误以
Microsoft JScript runtime error: Object doesn t support this property or method any help would be appreciable..