I have created this code to random my divs when I'm clicking on the button:
$('button').click(function(){
setInterval(function(){
var firstdiv = $('.roll div:first');
var lastdiv = $('.roll div:last');
firstdiv.insertAfter(lastdiv);
firstdiv = firstdiv.next();
}, 100);
});
How can I stop it after 5 seconds for example?
My Example: http://jsfiddle.net/L0aaxqrs/