MrEhawk82 MrEhawk82 - 2 months ago 14
Javascript Question

Marquee loop not infinite

I have a marquee in a game that i would like to repeat once finished.

var elems = "<br />";
elems += "<marquee id='m1' direction='left' width='800' scrolldelay='5' scrollspeed='true' scrollamount='2' loop='infinite' >";
if (exp >= 0) {
elems += "Galactic News:" + arr0[exp] + "";
}
if (lfLvl >= 0) {

elems += "Planet News: " + arr1[lfLvl] + "";
}
elems += "</marquee>";


when I run app, the variable goes to a part of the page where i want the marquee. It plays through fine. But once it's over, it's does not begin again. It will start again if the user navigates away and comes back.

I would like to know some reason why it isn't repeating, as well as a solution. If i can't do it, i'm not too bothered. It's just a polishing issue that i would like to get out of the way. Thank you to anyone that can help.

Another alternate solution i was thinking of, was to detect when the last item runs, and the marquee has finished, then to throw in a last thing saying something like "end of feed" or something like:

if (marquee === over) {
elems += "End of Feed";
}


but i don't know exactly how to do that over variable, so i kinda had my fingers crossed with attribute

loop='infinite'

Answer

try changing your loop to -1 like this:

<marquee id='m1' direction='left' width='800' scrolldelay='5' scrollspeed='true' scrollamount='2'  loop='-1' >
Comments