https://ru.stackoverflow.com/questions/517327/jquery-случайно-поменять-местами-блоки
|
1 2 3 4 5 6 7 |
$(function () { var parent = $("#shuffle"); var divs = parent.children(); while (divs.length) { parent.append(divs.splice(Math.floor(Math.random() * divs.length), 1)[0]); } }); |
|
1 2 3 4 5 6 7 8 9 10 11 |
<div id="shuffle"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> <div>9</div> </div> |