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.');
}
@ClaudiuCeia
Copy link

🎉

@ClaudiuCeia
Copy link

ClaudiuCeia commented Mar 15, 2018

Why is this not an actual repo so I can PR? :D

https://gist.github.com/ClaudiuCeia/39d73505afc3e87d69fa6bc1e1c757ab

@erikvorhes
Copy link
Author

Why is this not an actual repo so I can PR?

Because you’ve added something that is not a marquee, @ClaudiuCeia. COME ON

@ClaudiuCeia
Copy link

Fair enough 👎

@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