Skip to content

Instantly share code, notes, and snippets.

@st98
Last active August 29, 2015 14:14
Show Gist options
  • Save st98/0fff653a504d8a5627fc to your computer and use it in GitHub Desktop.
Save st98/0fff653a504d8a5627fc to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>x-marquee</title>
</head>
<body>
<p><x-marquee>marquee</x-marquee> | <x-marquee>marquee</x-marquee></p>
<a href="https://gist.github.com/st98/0fff653a504d8a5627fc">source</a>
<script>
document.registerElement('x-marquee');
Array.prototype.forEach.call(document.getElementsByTagName('x-marquee'), function (e) {
var s = e.textContent, i = 0;
setInterval(function () {
i = (i + 1) % s.length;
e.textContent = s.slice(i) + s.slice(0, i);
}, 250);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment