Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67556

Is there a way to run a line of code after a marquee has finished scrolling once?

$
0
0

Is there a way to run a line of code after a marquee has finished scrolling its text one time? I was going to use it to whenever the text was gone I would remove the element in the queue index with the location of 0 and then use the marquee to show the next element in the queue. How would I do this?

I'm kinda new to coding, so please excuse me if this is a bad question to ask.

let scroller = document.getElementById("scrollText")

let news = function (news, id) {
  this.text = news;
  this.id = id;
}

let newsFeed = [
  new news("Bob has slipped and fell once again. Oh dear.", 1),
  new news("Alicia has lost her keys.", 2)
]

let queue = []
scroller.innerHTML = queue[0]
queue.append(newsFeed[Math.round(math.random) * newsFeed.length])

//Whenever the marquee is done scrolling

queue.pop()
scroller.innerHTML = queue[0];

Viewing all articles
Browse latest Browse all 67556

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>