Last active
October 22, 2016 18:39
-
-
Save illepic/2e69feb8b57b700239cc3de6d600ca1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shuffle(shufflearray) { | |
var i = shufflearray.length; | |
var j; | |
var temp; | |
while(i-- > 0) { | |
j = Math.floor(Math.random() * (i + 1)); | |
temp = shufflearray[j]; | |
shufflearray[j] = shufflearray[i]; | |
shufflearray[i] = temp; | |
} | |
return shufflearray; | |
} | |
$(function() { | |
var cardsubset = shuffle(cardarray).slice(0,10); | |
var $container = $('<div>'); | |
cardsubset.forEach(function(element, index, array) { | |
var $img = $('<img>').attr('src', element.card); | |
$container.append($img); | |
}); | |
$('.card-images').append($container); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment