开发者

jquery cycle plugin redirect at end - callback basic question

I want to display some images but, at the of that, I would like to redirect.

$(document).ready(function() {
    $('.intro').cycle({
        fx: 'fade'
    });
window.location.replace("http://www.something.com");
});

This will not work, it seems that js don't wait for the intro开发者_高级运维 to finishes. Should I use a callback here?

Can I have some help here?

UPDATE:

The alert string never appears! :(

      $(document).ready(function() {
      $('.intro').cycle({
      fx: 'fade', 
window.location.replace("http://www.something.com"); }
      end: function() {window.alert("ola");}
      });
  });


A callback is indeed what you want. Check out the end option for the cycle plugin. The following should do it.

end: function() {window.location.replace("http://www.something.com");}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜