Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Element.prototype.blink = function(i) {
- var self = this;
- this.lastDisplay = this.style.display;
- this.change = true;
- this.blinkInterval = setInterval(function() {
- if (self.change) self.style.display = 'none';
- else self.style.display = self.lastDisplay;
- self.change = !self.change;
- }, i);
- }
- Element.prototype.stopBlink = function() {
- if(this.blinkInterval) clearInterval(this.blinkInterval);
- }
- document.getElementById('b').blink(60);
- document.getElementById('b').stopBlink();
- // Fiddle: https://jsfiddle.net/5d2s5La8/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement