3 ms·
Needs more blink.
by icey 17y ago
Needs more blink.
- jonursenbach 17y agoAnd copy/pasted DHTML snowflake effects.
- tlrobinson 17y agoApparently the BLINK tag doesn't actually work in some modern browsers, so I had to reimplement it in JavaScript. If you'd like to use it on your own site, here's the code: var blinkOn = 1; window.setInterval(function() { var blinks = document.getElementsByTagName("blink"); for (var i = 0; i < blinks.length; i++) blinks[i].style.visibility = blinkOn ? "visible" : "hidden"; blinkOn ^= 1; }, 500);
- icey 17y agoWell played, sir.
- ars 17y agoJust a small note - you should not explicitly set the visibility to "visible", set it to the empty string "" instead. This way you don't overwrite the default property if it was something else. And you can skip the blinkOn variable by: blinks[i].style.visibility = blinks[i].style.visibility == "" ? "hidden" : "";
- invisible 17y agoThat's actually way slower because you're doing a comparison within an iteration. That's putting an if statement inside a loop while the result is the same for every iteration.
- ars 17y agoComputers are not that slow these days :) It reduces complexity and a global, which is far more important. And that blink loop is probably not that big - just how many blink tags do you have? I don't use it for blink loops anyway, I use it for toggle on/off, where keeping state for each element individually is pretty important.
- invisible 17y agoYou're accessing the DOM every iteration, so I'd bet that it does matter somewhat if blink is used a lot. You can avoid polluting by make it an actual function and then setting the function.blinkOn instead. You're right: individually swapping them this works better, but the intent is to have them all off or all on. (function() { var blinkIterator = function() { var blinks = document.getElementsByTagName("blink"), onOff = blinkIterator.blinkOn ? "" : "hidden"; for (var i = 0, l = blinks.length; i < l;) blinks[i++].style.visibility = onOff; blinkIterator.blinkOn ^= 1; }; blinkIterator.blinkOn = 1; window.setInterval(blinkIterator, 750); })();
- catch23 17y agoYou don't need all that complexity. just use CSS: text-decoration: blink Works in FF 3.5
- tlrobinson 17y agoWell, no. Browsers that don't support "blink" tags also don't support "text-decoration: blink". I'd hardly call it complex either.
- zaidf 17y agoWhere the marquee at??
- nopassrecover 17y agoNeeds more of this site: http://csszengarden.com/?cssfile=http://www.brucelawson.co.uk/zen/sample.css http://csszengarden.com/?cssfile=http://www.brucelawson.co.u...