我有一个在网页上推进滚动图像的功能。可以在这里看到:
http://leadgenixhosting.com/~intmed/
右箭头是您单击以推进图像的方向。我在使用 .unbind() 的地方遇到了这个问题,因此在图像使用 .animate() 完成之前,箭头是不可点击的,这样它们就不会不同步。但我不完全确定如何使用 .bind() 使箭头再次可点击。
这是函数当前的样子:
$('#in-right').click(
function(){
$('#in-right').unbind('click');
imageSwitch();
$('#in-right').bind('click');
}
);
我显然错误地实现了绑定。我怎样才能正确实施它?
这是我的 imageSwitch() 函数:
function imageSwitch(){
current++;
current_image++;
previous_image++;
next++;
two_prev++
if(two_prev >= divs.length){
two_prev = 0;
}
if(current >= gallery_images.length){
current = 0;
}
if(previous_image >= divs.length){
previous_image = 0;
}
if(current_image >= divs.length){
current_image = 0;
}
if(next >= divs.length){
next = 0;
}
$('#'+divs[current_image]+'').animate({left:'-=1020px'},{queue:false,duration:1000})
$('#'+divs[current_image]+'').css('background-image','url('+gallery_images[current]+')');
$('#'+divs[previous_image]+'').animate({left:'-=1020px'},{queue:false,duration:1000});
$('#'+divs[next]+'').animate({left: '+=1020px', top: '-=10000px'}, 1000);
$('#'+divs[two_prev]+'').animate({left: '+=1020px', top: '+=10000px'}, 1000);
}