Skip to content

Instantly share code, notes, and snippets.

@ClaudiuCeia
Forked from erikvorhes/marquee.js
Last active March 15, 2018 08:26
Show Gist options
  • Save ClaudiuCeia/39d73505afc3e87d69fa6bc1e1c757ab to your computer and use it in GitHub Desktop.
Save ClaudiuCeia/39d73505afc3e87d69fa6bc1e1c757ab to your computer and use it in GitHub Desktop.
You need a marquee. And a blink.
/**
* This marquee stuff is deliberately low-tech. Use at your own risk. Licensed under whatever license you need.
*
* Usage: `marquee();`
*/
function marquee(behavior, direction) {
var behaviors = {
scroll: 'scroll',
slide: 'slide',
alternate: 'alternate'
};
var directions = {
left: 'left',
right: 'right',
up: 'up',
down: 'down'
};
var marquee = document.createElement('marquee');
if (behavior && behaviors.hasOwnProperty(behavior)) {
marquee.behavior = behavior;
}
if (direction && directions.hasOwnProperty(direction)) {
marquee.direction = direction;
}
marquee.innerHTML = document.body.innerHTML;
document.body.innerHTML = '';
document.body.appendChild(marquee);
console && console.log('Enjoy.');
}
function blink() {
var html = document.body.innerHTML;
var is_blink = false;
setInterval(function() {
if (!is_blink) {
document.body.innerHTML = '';
is_blink = true;
} else {
document.body.innerHTML = html;
is_blink = false;
}
}, 500)
console && console.log('Enjoy.');
}
@erikvorhes
Copy link

Very clever implementation of <blink />, but what is it doing in marquee.js‽ ;)

@erikvorhes
Copy link

Add blink.js to Useless-JS!

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