Namaste!
My simple issue is that $sortedData becomes undefined in the following code upon execution:
(function($) {
$.fn.shuffle = function (){
var i = this.length, j, temp;
if ( i == 0 ) { return; }
while ( --i ) {
j = Math.floor( Math.random() * ( i + 1 ) );
temp = this[i];
this[i] = this[j];
this[j] = temp;
}
};
})(jQuery);
// DOMContentLoaded
$(function() {
// get the first collection
var $cards = $( #cards );
// clone cards to get a second collection
var $data = $cards.clone();
// call Quicksand when button clicked
$( #shuffle ).click(function(e) {
// get all the list items
var $filteredData = $data.find( li );
// random sort (shuffling)
var $sortedData = $filteredData.shuffle();
// finally, call quicksand
$cards.quicksand($sortedData, {
duration: 600,
easing: easeInOutQuad
});
});
});
如何要求: 我有一个顿子,在被点击时,执行上述法典。
我检查了sh子功能中的数值,在要求穿透功能之前,但是,当sh子功能返回时,没有界定 $子。
The error is probably a noobish one, but, I can t see it.
感谢你的投入!