gpt4 book ai didi

jquery - 我的 jquery 插件出了什么问题,无法在 jquery 1.5.0 中工作

转载 作者:行者123 更新时间:2023-12-01 06:06:50 26 4
gpt4 key购买 nike

/* ------------------------------------------------------------------------
plugin-name:zxdSlider
Developped By: ZHAO Xudong -> http://html5beta.com
Version: 1.0
Copyright: Feel free to redistribute the script/modify it, as
long as you leave my infos at the top.
------------------------------------------------------------------------ */
(function($){
$.fn.zxdSlider = function() {
var zxdCaller = this.attr('id');
var sliderUnit = $("#"+zxdCaller);
var sc = $("."+zxdCaller+"li");
var queueName = zxdCaller+"Queue";//queue-name
var delayFlag = false;
var current = 0; //current is the slider index
var maxNo = -1;
sc.each(function(i){maxNo=i}); // check how many unit to slide
var shortDelay = 600;
var longDelay = 3000;
var fq = [ //this is the function loop.after it fires,it never ends
function(){sc.eq(current).show(shortDelay,af);},
function(){setTimeout(af,shortDelay);},
function(){sc.eq(current).children("span").show(shortDelay,af)},
function(){setTimeout(af,longDelay);},
function(){
if (delayFlag==false){//if mouseover ,the current slider do not hide
sc.eq(current).children("span").hide(shortDelay/2,af);
}
else {
af();
}
},
function(){
if (delayFlag==false){ //if mouseover ,the current slider do not hide
sc.eq(current).hide(shortDelay/2,af);
}
else {
af();
}
},
function(){
if(delayFlag==false) { //if mouseover ,slider index stays the same.
current++;
af();
}
else{
af();
}
},
function(){// the last function fires the loop again
slider();
}
];
var af = function(){//use dequeue to make the loop move forward
$(document).dequeue(queueName);
};
$(".rightnav").click(function(){//click to see next slider
sc.eq(current).children("span").hide(shortDelay/2);
sc.eq(current).hide(shortDelay/2);
current++;
});
$(".leftnav").click(function(){//click to see previous slider
sc.eq(current).children("span").hide(shortDelay/2);
sc.eq(current).hide(shortDelay/2);
current--;
});
sliderUnit.hover( //when mouseover the slider, freeze slider,show the button
function(){
delayFlag=true;
$(".slidernav").css("color","#fff");
longDelay/=4;
},
function(){ //when mouse leave, slider back to normal,hide the button
delayFlag=false;
$(".slidernav").css("color","transparent");
longDelay*=4;
}
);
var slider = function(){//where the slider starts
if(current>=(maxNo+1)) {current=0;}
if (current<=-1) {current=maxNo;}
$(document).queue(queueName,fq);
af();
}
slider();//fire the loop
};
})(jQuery);

您可以在 http://html5beta.com/a-demo-for-zxdslider/ 观看我的演示从 Firebug 或其他东西中读取它。它适用于 jquery 1.4.4 及之前版本,只是不适用于 jquery 1.5.0。我实在不明白为什么。 slider 因某种未知原因而停止。

最佳答案

jQuery 1.5 似乎重新引入了 1.3 版本中也存在的错误。

如果队列名称不是“fx”,则队列将中断。

我做了一个demo问题在这里,并提交了ticket .

所以现在,我只需更改此行 #13

var queueName = zxdCaller+"Queue";//queue-name

到此

var queueName = "fx";//queue-name

关于jquery - 我的 jquery 插件出了什么问题,无法在 jquery 1.5.0 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4987978/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com