jquery move elements into a random order

前端 未结 5 934
难免孤独
难免孤独 2020-12-01 11:23

I am attempting to display a series of images in a random order. However, I do not want any single item to repeat until all items have been shown, so instead of selecting a

5条回答
  •  遥遥无期
    2020-12-01 11:56

    You can also use the common JavaScript Array randomize sorter, also commented here and here:

    $('').sort( function(){ return ( Math.round( Math.random() ) - 0.5 ) } );
    

提交回复
热议问题