Skip to content

Instantly share code, notes, and snippets.

@erikvorhes
Last active March 15, 2018 18:34
Show Gist options
  • Select an option

  • Save erikvorhes/d926a3e92ced0505610a3880bf36dff8 to your computer and use it in GitHub Desktop.

Select an option

Save erikvorhes/d926a3e92ced0505610a3880bf36dff8 to your computer and use it in GitHub Desktop.
You need a marquee.
/**
* This marquee stuff is deliberately low-tech. Use at your own risk. Licensed under whatever license you need.
* Also available as a part of https://github.com/erikvorhes/Useless-JS
*
* Usage: `marquee();`
*/
function marquee(behavior, direction) {
var behaviors = ['scroll', 'slide', 'alternate'];
var directions = ['left', 'right', 'up', 'down'];
var marquee = document.createElement('marquee');
if (behavior && behaviors.includes(behavior)) {
marquee.behavior = behavior;
}
if (direction && directions.includes(direction)) {
marquee.direction = direction;
}
marquee.innerHTML = document.body.innerHTML;
document.body.innerHTML = '';
document.body.appendChild(marquee);
console && console.log('Enjoy.');
}
@erikvorhes
Copy link
Author

@ClaudiuCeia -- You'll be happy to know that I just added marquee.js to Useless-JS. Feel free to add blink.js via pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment