开发者

jQuery not animating links

I am trying to get the fade effect of my image slider plugin to work correctly with links.

At the moment the slider fades correctly however the links are failing to change. The first image is supposed to link to Google.com & the second link is supposed to link to H开发者_Go百科otmail.com however both of them are linking to Hotmail.com only (the link for the last image; this is the case no matter how many images you use).

To achieve the fade I am using .animate({opacity:0}}) & 1, etc. Here are the lines that seem to effect the animation (72, 215 & 216 respectively):

$(this.slides).css('opacity',0).eq(this.currentNo).css('opacity',1);

$(this.slides).stop().animate({opacity:0}, {
        duration: this.settings.duration,
        easing:this.settings.easing
} );
$(this.slides).eq(index).stop().animate( {opacity:1}, {
        duration: this.settings.duration,
        easing:this.settings.easing
} );

Source: http://pastebin.com/9JwaM9tg

Test site: http://matthewruddy.com/demo

Thanks to anyone who can help me out. Really appreciate it.


You are only setting the opacity of the li so while it is not visible it is still displayed when the opacity reaches 0 you should set display: none so that the li is completely hidden this should then allow the currently visible image to link properly.

$(this.slides).css({'opacity':0, 'display':'none'}).eq(this.currentNo).css({'opacity':1, 'display':'block'});

$(this.slides).stop().animate({opacity:0}, {
    duration: this.settings.duration,
    easing:this.settings.easing,
    complete:function(){
        $(this).css({'display':'none'});
    }
});

$(this.slides).eq(index).stop().css('display','block').animate( {opacity:1}, {
    duration: this.settings.duration,
    easing:this.settings.easing
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜