lundi 13 juin 2016

How to Flip Div's Randomly Back then Front Again

Reference: How to Flip Div's in Randomly and The working fiddle: http://ift.tt/1WLJhQd

I have the above random image flipping script working on my site. Currently it flips a random image and lets it stay in that state, then moves on to another randome image and flips it and leaves it in that state, etc.

What I need it to "unflip" after each flip before moving on to the next random image. Here is an example of how I want it to work: http://ift.tt/1UvSjKZ

Here is the jQuery in question:

$(document).ready(function () {
    var $flippers = $(".flip-container"),
    qtFlippers = $flippers.length;

    setInterval(function () {
    $flippers.eq(Math.floor(Math.random()*qtFlippers)).toggleClass('hover'); }, 2000);
});




Aucun commentaire:

Enregistrer un commentaire