Hello.

I have this HTML code:

<div class="good">Текст 1</div> <div class="good">Текст 2</div> <div class="good">Текст 3</div> <div class="good">Текст 4</div> 

The .good class .good hidden display:none; .

How can I make this script $("div[class^='good']").show('normal') page $("div[class^='good']").show('normal') not to open all the blocks at once, but sequentially when the page loads?

    1 answer 1

    To begin with, your design:

     $("div[class^='good']"); 

    This is just a crazy disregard for CPU time and resources, please use:

     $('.good'); 

    Well, on the subject matter can be done like this:

     var $target = $('.good'); var hold = 200; $.each($target,function(i,t){ var $this = $(t); setTimeout(function(){ $this.show('normal'); },i*hold); }); 

    I also applied a 'hold' delay, which gives the effect of successive opening.

    • jsfiddle.net/7kw82g6g like, everything is copied, does not work. :) - MasterAlex
    • one
      jsfiddle.net/7kw82g6g/1 Everything works, put the script in $(document).ready(function(){ ... }); because You run it before loading the page content. - ferrari
    • Exactly, forever with this fidl confused because of this. - MasterAlex