setTimeout doesn't work with window.location?

Posted by Syom on Stack Overflow See other posts from Stack Overflow or by Syom
Published on 2010-06-13T17:42:45Z Indexed on 2010/06/13 17:52 UTC
Read the original article Hit count: 227

Filed under:
|
|

i try to rich flash like effect when changing window location, but there is a small problem, i can't solve.

look at the script please

 $(document).ready(function(){

            $('a.flash').click(function(e) {
                e.preventDefault();
                $('body').fadeOut(1500);
                setTimeout("", 1500);
                window.location=this.href;
            }); 
      });

window.location=this.href must be done after 1500ms, but it doesn't happen. could you explain why? what is strange, when i try to write alert("something"); instead of window.location=this.href, it works fine. Could you explain why?

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery