Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript I can't figure out why a JS text scroller isn't working. Reply To: I can't figure out why a JS text scroller isn't working.

#182520
__
Participant

Here, try this. Much updated. I haven’t tested it fully, but it should work on major browsers back to IE8.

Changes you need make: Put your scrolling content in an element with a “data-scroller” attribute (like <div data-scroller>My scrolling content!</div>). If you want more than one scroller on a page, you need to collect them all (e.g., querySelectorAll('[data-scroller'])) and call the scroller function on each. The script needs to run on load (i.e., on document ready, or put the script tag at the bottom of the page).