Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change <li> position after animation using jquery?
    primarykey
    data
    text
    <p>I have a jquery image slider that is set to move the images -100% to the left.<br> When the image gets to left:-100%; is there a way to have it move back to the beginning of the cycle?</p> <pre><code>&lt;div id="homeslider" class="firefly_slider_wrapper"&gt; &lt;div class="firefly_slider"&gt; &lt;ul id="ffslider"&gt; &lt;li class="slide"&gt; &lt;div class="slideplacment"&gt; &lt;img src="" name="0" /&gt; &lt;/div&gt; &lt;/li&gt; &lt;li class="slide"&gt; &lt;div class="slideplacment"&gt; &lt;img src="" name="1" /&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><em>The script looks like this:</em></p> <pre><code>jQuery(window).load(function(){ var tl2 = new TimelineMax({onComplete: upDatePosition}); var imgArray = []; var imgLength = 0; var photoContWidth = 0; var imgWidth = 0; n = jQuery("#ffslider li").length; function setDefaults(){ imgLength = jQuery('#ffslider li').length; photoContWidth = (imgLength * 100) + '%'; for(var i=0; i&lt;imgLength; i++){ jQuery('#ffslider li').eq(i).attr('name',i); jQuery('#ffslider li').eq(i).css('left', (i * 100) + "%"); imgArray.push(jQuery('#ffslider li').eq(i)); } startAnimation(); }; function startAnimation(){ tl2.to(imgArray, 1, {left:'-=100' + '%', delay:3}); } function upDatePosition(){ for(var i=0; i&lt;imgLength; i++){ if((imgArray[i].css('left') &lt;= -100 + '%')){ imgArray[i].css("left", (n - 1) * '100' + '%'); } } startAnimation(); } setDefaults(); }); </code></pre> <p>Its dynamic and used in a WordPress theme.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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. 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