Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was animating the children, but found that on a continuous loop it jerked. After attempting to use margins, I re-visited the jquery site and the definition for <strong>animate</strong> I realised that the default effect for animate is "swing", which is what was causing my jerking. So, I amended my code to this:</p> <pre><code>animateItem: function (self, speed) { var $item = $(self.settings.itemClass).first(); var width = $item.outerWidth(true); var left = parseInt($item.css("left")); if (left &lt; 0) { self.moveItem(self, speed, 1); } else { $item.animate({ "left": "-" + width + "px" }, { duration: speed, easing: "linear", step: function (now, fx) { $(self.settings.itemClass + ":gt(0)").css("left", now); } }); } }, moveItem: function (self, speed, count) { if (count &gt; 0) { var $item = $(self.settings.itemClass).first(); $item.hide(speed, "linear", function () { $(this).appendTo(self.settings.itemContainerClass).show(speed, "linear"); self.moveItem(self, speed, count - 1); // Repeat }); } }, </code></pre> <p>This just animates a single object, to get the idea of what an object can look like, here is some html :)</p> <pre><code>&lt;div id="carousel" class="carousel"&gt; &lt;div class="carousel-container"&gt; &lt;div class="carousel-item yellow"&gt; &lt;div class="carousel-photo"&gt; &lt;img src="http://www.csupomona.edu/~ieee/profile/2012/uman.png" /&gt; &lt;/div&gt; &lt;p&gt;Hicks, Bill&lt;/p&gt; &lt;/div&gt; &lt;div class="carousel-item green"&gt; &lt;div class="carousel-photo"&gt; &lt;img src="http://www.csupomona.edu/~ieee/profile/2012/uman.png" /&gt; &lt;/div&gt; &lt;p&gt;Jeremy, Ron&lt;/p&gt; &lt;/div&gt; &lt;div class="carousel-item blue"&gt; &lt;div class="carousel-photo"&gt; &lt;img src="http://www.csupomona.edu/~ieee/profile/2012/uman.png" /&gt; &lt;/div&gt; &lt;p&gt;Little, John&lt;/p&gt; &lt;/div&gt; &lt;div class="carousel-item violet"&gt; &lt;div class="carousel-photo"&gt; &lt;img src="http://www.csupomona.edu/~ieee/profile/2012/uman.png" /&gt; &lt;/div&gt; &lt;p&gt;Smith, Will&lt;/p&gt; &lt;/div&gt; &lt;div class="carousel-item purple"&gt; &lt;div class="carousel-photo"&gt; &lt;img src="http://www.csupomona.edu/~ieee/profile/2012/uman.png" /&gt; &lt;/div&gt; &lt;p&gt;Shakespear, William&lt;/p&gt; &lt;/div&gt; &lt;div class="carousel-item pink"&gt; &lt;div class="carousel-photo"&gt; &lt;img src="http://www.csupomona.edu/~ieee/profile/2012/uman.png" /&gt; &lt;/div&gt; &lt;p&gt;Jameson, Jenny&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>To animate constantly, I created this function:</p> <pre><code>animateWheel: function (self, speed, count) { var $item = $(self.settings.itemClass).first(); var width = $item.outerWidth(true); $item.animate({ "left": "-" + width + "px" }, { duration: speed, easing: "linear", step: function (now, fx) { $(self.settings.itemClass + ":gt(0)").css("left", now); }, complete: function () { self.moveItem(self, speed, count); } }); }, </code></pre> <p>And my options look like this:</p> <pre><code>defaults = { itemsPerPage: 4.5, itemContainerClass: '.carousel-container', itemClass: '.carousel-item', startButton: '#start', carouselPage: '#carouselPage', contentElement: '.ui-content' }; </code></pre> <p>Hopefully that will give someone else having the same issue some idea of what to do :) My next stage is to try and slow down the animation (for the continuous loop) before it stops</p>
    singulars
    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