Friday, September 12th, 2008

blink at the marquee one more time

Category: JavaScript, jQuery

Remy Sharp gives us a blast form the past for the some Friday fun.

First, he shows his Marquee plugin that gives you the marquee effect. Why would you do this when the marquee tag itself is widely adopted?

Funnily enough, the marquee tag is pretty well supported amongst the browser, but the actual effect is poorly executed natively (which is kind of odd if it’s built directly in to the browser).

You can see how the untouched marquees are jumpy to animate, even in the later browsers such as Firefox 3 and Safari – let alone IE6.

It is simple to use, and gives you hooks to do more:

javascript

  1. // Hello World
  2. $('marquee').marquee();
  3.  
  4. // Adding fun
  5. $('div.demo marquee').marquee('pointer').mouseover(function () {
  6.   $(this).trigger('stop');
  7. }).mouseout(function () {
  8.   $(this).trigger('start');
  9. }).mousemove(function (event) {
  10.   if ($(this).data('drag') == true) {
  11.     this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
  12.   }
  13. }).mousedown(function (event) {
  14.   $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
  15. }).mouseup(function () {
  16.   $(this).data('drag', false);
  17. });

Or, you could get into a lot of trouble and reimplement blink:

javascript

  1. $(function () {
  2.  setInterval(function () {
  3.    $('blink').each(function () {
  4.      this.style.visibility = this.style.visibility == 'hidden' ? 'visible' : 'hidden';
  5.    });
  6.  }, 1000);
  7. });

Posted by Dion Almaer at 5:32 am
4 Comments

++---
2.6 rating from 49 votes

4 Comments »

Comments feed TrackBack URI

Just remember that for accessibility concerns, it is strongly recommended (see WCAG) not to use either blink or markee, nor try to make equivalent effect.

Benoît

Comment by benoitd — September 15, 2008

It’s no where near the 1st of April – I don’t get it. Is this for real?

Comment by MountainAsh — October 5, 2008

Nice! looking for this. Thanks

Comment by Naruto — October 9, 2008

A valiant effort at reviving/updating the marquee tag. I don’t think I would ever use the marquee tag again even with this sexy new version, simply because of the horrible memories!

Comment by JasonStockman — October 31, 2008

Leave a comment

You must be logged in to post a comment.