Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get .delay() working

Tags:

jquery

delay

I have almost zero experience with jQuery so here it goes... I have already done a lot of research but I just can't figure out what I'm doing wrong...

I want two DIV's to fade in after each other, but with a delay between the first one and the second one. This is what I have so far:

   <script type="text/javascript">

$(document).ready(function(){

        $("div.1").hide();
        $("div.2").hide();
        $("div.1").fadeIn(400);
        $("div.2").delay(800).fadeIn(400);
});

</script>
<div class="1">
This is DIV1</div>
<div class="2">
This is DIV2</div>

I really hope you guys can help me out! Thanks in advance :)

like image 898
FrK Avatar asked Nov 25 '25 19:11

FrK


1 Answers

The .delay method was added in jQuery 1.4, so if you were loading jQuery 1.3, as you indicate in a comment, then that's your problem. Your code should work correctly, as written, with 1.4 or later.

like image 174
dgvid Avatar answered Nov 28 '25 15:11

dgvid