15 lines
No EOL
699 B
JavaScript
15 lines
No EOL
699 B
JavaScript
/**
|
|
* jQuery Shuffle (http://mktgdept.com/jquery-shuffle)
|
|
* A jQuery plugin for shuffling a set of elements
|
|
*
|
|
* v0.0.1 - 13 November 2009
|
|
*
|
|
* Copyright (c) 2009 Chad Smith (http://twitter.com/chadsmith)
|
|
* Dual licensed under the MIT and GPL licenses.
|
|
* http://www.opensource.org/licenses/mit-license.php
|
|
* http://www.opensource.org/licenses/gpl-license.php
|
|
*
|
|
* Shuffle elements using: $(selector).shuffle() or $.shuffle(selector)
|
|
*
|
|
**/
|
|
(function(d){d.fn.shuffle=function(c){c=[];return this.each(function(){c.push(d(this).clone(true))}).each(function(a,b){d(b).replaceWith(c[a=Math.floor(Math.random()*c.length)]);c.splice(a,1)})};d.shuffle=function(a){return d(a).shuffle()}})(jQuery); |