Last active
August 29, 2015 14:07
-
-
Save munro/b973130e28d08881c886 to your computer and use it in GitHub Desktop.
This file contains 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
<html> | |
<head> | |
<script> | |
setInterval(function () { | |
var elements = document.querySelectorAll('.blink'); // I'm pulling every element from the DOM with class "blink" | |
for (var i = 0; i < elements.length; i += 1) { // iterate through all the elements | |
var element = elements[i]; | |
if (!element.style.visibility) { // if no visibility is set, it means it's displayed | |
element.style.visibility = 'hidden'; // so lets hide it | |
} else { | |
element.style.visibility = ''; // otherwise show it again! | |
} | |
} | |
}, 250); // My function I've passed to setInterval will run every 250 milliseconds | |
</script> | |
</head> | |
<body> | |
<h1 class="blink">I'm blinking</h1> | |
<p>I'm not!</p> | |
<ul> | |
<li>Me either</li> | |
<li class="blink">But I am too!</li> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment