Last active
March 15, 2018 18:34
-
-
Save erikvorhes/d926a3e92ced0505610a3880bf36dff8 to your computer and use it in GitHub Desktop.
You need a marquee.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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.'); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ClaudiuCeia -- You'll be happy to know that I just added
marquee.jsto Useless-JS. Feel free to addblink.jsvia pull request.