dimanche 3 novembre 2019

Trying to randomize a news ticker interval in jQuery

I have a jQuery-based scrolling news ticker that uses a set interval in milliseconds to control the delay between the reveal of each new section of text. I'd like to randomize the delay so that it more closely mimics the way a realtime news feed would look.

I've tried experimenting with some Math.random javascript where the "newsTickerInterval" parameter is, but JS is not my native language and I'm having trouble making it work.

Here's the jQuery function my scroller uses to config the display:

$(function () {         
$(".demo2").bootstrapNews({
        newsPerPage: 4,
        autoplay: true,
        pauseOnHover: true,
        navigation: false,
        direction: 'down',
        newsTickerInterval: 3000,
        onToDo: function () {
            //console.log(this);
        }
    });       
});

Any hints/suggestions would be greatly appreciated!




Aucun commentaire:

Enregistrer un commentaire