我的脚本需要一点帮助。我正在尝试从默认幻灯片(#slide1)中隐藏左导航箭头。一开始可以工作,但是当用户通过幻灯片放映并返回到同一张幻灯片(#slide1)时,会显示箭头。看看我的脚本,有人可以告诉我我做错了什么:
var curSlide = 0;
function setSlide(num,dir){
var oldSlide = curSlide;
if(num>5) num = 1;
else if(num<1) num = 5;
var showDir = "";
var hideDir = "";
(dir=="f"){
showDir = "right";
hideDir = "left";
} else {
showDir = "left";
hideDir = "right";
}
if(curSlide == 0){
$("#slide1").show();
$('#left_arrow').hide();
curSlide = 1;
} else {
curSlide = num;
$("#slide"+curSlide).show('slide',{direction:showDir},600);
$("#slide"+oldSlide).hide('slide',{direction:hideDir},600);
$('#left_arrow').show();
}
}
function nextSlide(){
setSlide(curSlide*1+1,"f");
}
function prevSlide(){
setSlide(curSlide*1-1,"b");
}
$(document).ready(function () {
if($('#show_picks')) {
$('#show_picks area').each(function() {
$(this).click(function(e) {
e.preventDefault();
setSlide($(this).attr('id'),"f");
});
$(this).mouseover(function(e) {
$(this).css("cursor", "pointer");
});
$(this).mouseout(function(e) {
$(this).css("cursor", "default");
});
});
}
$("#left_arrow").click(function(e) {
e.preventDefault();
prevSlide();
});
$("#right_arrow").click(function(e) {
e.preventDefault();
nextSlide();
});
$("#left_arrow").mouseover(function(e) {
$("#left_arrow").css("cursor", "pointer");
});
$("#left_arrow").mouseout(function(e) {
$("#left_arrow").css("cursor", "default");
});
$("#right_arrow").mouseover(function(e) {
$("#right_arrow").css("cursor", "pointer");
});
$("#right_arrow").mouseout(function(e) {
$("#right_arrow").css("cursor", "default");
});
for(var i=2;i<6;i++){
$("#slide"+i).hide();
}
setSlide(0,"f");
});