Wednesday, April 10, 2013

RIP Blinky

A sad, sad day. The much-maligned <blink> tag is being removed from the last browser that supported it, Firefox.

Thankfully, we can easily come up with an even more annoying alternative, our own special programmatic "blink" that has adjustable speed and alternating blinkage.

First, apply a "class" attribute to whatever you want to blink:

<div class='blink'><p>PUT ANNOYING BLINKY STUFF HERE</p></div>

You can use tags other than <div> -- <span> is a good choice too. Note that more than one item can have the same "class" so you can do that multiple times. In fact you should, because that way they'll alternate states and be extra annoying.

Now, add just a tiny bit of code:

<script type="text/javascript">
var delay=100; // change to adjust speed

function annoy() {
  var annoyances = document.getElementsByClassName('blink');
  var positive=1;
  for (var i=annoyances.length - 1; i>=0; i--) {
    var b = annoyances[i];
    if (positive === 1) {
      b.style.visibility = (b.style.visibility === 'visible') ? 'hidden' : 'visible';
      positive = 0;
    } else {
      b.style.visibility = (b.style.visibility === 'hidden') ? 'visible' : 'hidden';
      positive = 1;
    }
   }
   window.setTimeout(annoy, delay);
}

annoy();
</script>

Presto:

Oh yeah, that's the stuff. The blink is dead, long live the blink!

UPDATE: I fixxorated it so it'll work (hopefully) with a new-ish version of Internet Exploder too. Woudln't want bbkf and Mooser to miss out.

19 comments:

  1. Hey, that works in the body of the post from the HTML compose screen?

    ReplyDelete
  2. I'm sure Monsieur McGravitas or Smut Clyde could cook up something just as seizure-inducing.

    ReplyDelete
    Replies
    1. I would be surprised if they hadn't already.

      Delete
  3. Is that a challenge?
    http://eusa-riddled.blogspot.co.nz/2010/08/pattern-induced-flicker-colours.html

    ReplyDelete
  4. I get no blink. Is there blink? Should I be seeing blink?
    Oh wait, O-r-e-g-o-n. Darn, I thought this was a B3 site.

    ReplyDelete
  5. Damn, you, sir. Damn your eyes!

    ReplyDelete
  6. Replies
    1. Hey, at least Zappa is dead. Your Mekons haven't even been kind enough to zombify themselves yet.

      Delete
  7. Replies
    1. I simply must come up with code to replicate a blinking marquee tag for the truly horrific 1998 Angelfire website effect. I can sense another post coming on!

      Delete
  8. *Sniff* I'm pouring some beer out. It's for Blinky.

    ReplyDelete
  9. hey, what gives? i see no blinky here...i do over at riddled...am i just not cool or what?

    ReplyDelete
    Replies
    1. Probably won't work if you're using Internet Explorer. I've tested it with everything else though.

      Delete

By commenting here you're legally bound to buy me lots of yummy beer.