-
-
Save madrobby/333764 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// pure JS | |
function shuffle(array) { | |
return array.sort(function(){ | |
return .5 - Math.random(); | |
}); | |
} | |
// with Prototype.js you can do | |
function shuffle(array){ | |
return array.sortBy(Math.random); | |
} |
in jplayer of course :)
eccajune: Mind being more specific? I'm looking to shuffle a jPlayer Video Playlist but I don't know at what hook to insert this code. Thank you for your help.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where do i insert this piece of code? :) i can't seem to make it work.
I have 11 songs.
Do i need to edit the code:
// pure JS
function shuffle(array) {
return array.sort(function(){
return .11 - Math.random();
});
}
I putted it below the head in my html file, under the playlist.