Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I try to do something. Sorry if I don't reuse your code. I hope you can configure as you want.</p> <pre><code>var distance_to_walk = $("#latest").width(); var interval_between_floater = 50; // distance in pixel between each floater var distance_pop = distance_to_walk - 32; // replace 32 by the width of a floater var step = 2; // the number pixel through by floater at each step var number_floaters = 8; // number of floater to display var delay_between_frame = 10; var duration_animation = 1000 * 10 * 3; $('.floater').each(function(){ $(this).css('left',distance_pop + 'px') ; }); var i=0; var number_frames = duration_animation/ (delay_between_frame + 2); var cpt_frames = 0; var interval = setInterval(function(){ $('.floater').each(function(){ $(this).css('left', ($(this).offset().left-2) + "px"); if(!$(this).hasClass("spawned") &amp;&amp; ($(this).offset().left + $(this).width() + interval_between_floater) &lt;= distance_pop ){ // If a spawner can spawn another floater if( i &lt; number_floaters){ //If the maximum floaters is not good var new_floater = $(this).clone(); $("#latest").append( new_floater ); // Move the floater at the beginning $(new_floater).css('left', distance_pop + 'px'); // Add this to disable the spawning with this floater $(this).addClass("spawned"); i++; } } if( $(this).offset().left &lt;= -($(this).width())){ // If the floater is out of screen $(this).css("left", distance_pop + 'px'); } }); cpt_frames++; if(cpt_frames &gt;= number_frames){ console.log("fin"); clearInterval(interval); return; } }, delay_between_frame); </code></pre> <p>You can test the example <a href="http://jsfiddle.net/charlesjourdan/MZhDh/3/" rel="nofollow">here</a></p> <p>EDIT : </p> <p>New example <a href="http://jsfiddle.net/charlesjourdan/MZhDh/10/" rel="nofollow">here</a>.</p> <p>EDIT 2 : </p> <p>The example with the relative postion <a href="http://jsfiddle.net/MZhDh/17/" rel="nofollow">here</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload