vendredi 30 novembre 2018

Random Div Display on Reload

<div class='quote'>
</div>
<div class='layout_atest news'>
</div>
<div class='quote'>
</div>

Currently I have a mix of news items and some customer reviews whoch are in the 'quote' div. I need two quotes to be shown randomly, on each reload, out of the several 'quote' div. So far i have this function

$(function() {
    var random=Math.floor(Math.random() * $('.quote').length);
    $('.quote').hide().eq(random).show().css('display','inline-block');
});

But it displays just one quote div, any way that I can have two random div displayed on reload, without subsequent repetition.




Aucun commentaire:

Enregistrer un commentaire