samedi 23 novembre 2019

Order by random a list of div elements with JS

I have a category that contains more than 200 newsitems, on the homepage I display the last 20 newsitems.

<div class="container-category">
   <div class="col-3">item 1</div>
   <div class="col-3">item 2</div>
   <div class="col-3">item 3</div>
   <div class="col-3">item 4</div>
   <div class="col-3">item ..n</div>
</div>

How to make the list of <div class="col-3"> appear randomly with Javascript ?

OrderBy = random




Aucun commentaire:

Enregistrer un commentaire