How To Flip Div's In Randomly
I have created the application where All divs are Flip Vertically on hover. I wanted to make it random without hover. How should I do that? Any suggestions would be thankful.
Solution 1:
I simplified your markup and CSS quite a bit. Also gave it a more 3D look. You can use setInterval to flip them hover:
http://jsfiddle.net/7x75466y/5/
var $flippers = $(".flip-container"),
qtFlippers = $flippers.length;
setInterval(function () {
$flippers.eq(Math.floor(Math.random()*qtFlippers)).toggleClass('hover');
}, 1000);
Solution 2:
Here is a JSfiddle that selects a random tile, and applies an action to it at every second (using setTimeout). You can perform whatever action you like on the tile. Using jQuery
http://jsfiddle.net/7x75466y/2/
var containers = $(".flip-container")
setInterval(function() {
var target = containers.eq(Math.floor(Math.random() * containers.size()))
target.fadeToggle() //DO WHAT YOU WANT TO THE TARGET
}, 1000)
Post a Comment for "How To Flip Div's In Randomly"