views:

240

answers:

1

I'm having a problem using the jquery hover events. I've created a reduction of the problem. You can find a working demonstration here. I can reproduce this after moving the mouse around in IE, FF, Opera, and Chrome.

I'm using queued animations in my mouseover event. Roughly 1% of the time, the color of the td elements is left as #0f0 after the mouse has left the td though. This should not be. The mouseout event should guarantee that eventually all tds turn back to #00f after a time has passed.

Update 2:

I've now reduced this probably about as far as it will go. No mouse events used at all. It's started working better in Opera, but now IE is a total cluster.

Anyway, I'm using a button to trigger this:

function ani() {
 $('td')
  .stop()
  .animate({backgroundColor: '#0f0'}, 3000)
  .animate({backgroundColor: '#00f'}, 3000);
}

See it here.

Update [n + 1]:

I just can't leave this alone. I've determined that the animation actually is occurring. It's just not automating the background color. I've done this by adding text and animating the background and foreground in unison. Under normal conditions, you should never see the text once it starts animating, but sometimes the background gets "forgotten", and sometimes the foreground. This indicates to me, that a jquery animation is actually occurring, but it is just not animating all the attributes it was instructed to. For the curious, see it in action here. (warning: IE chokes pretty hard on this)

Ok, going to play some video games now.

+2  A: 

I don't understand how you get your 1% figure. I'm not sure about what behavior you're seeing, but in both FF3 and IE8 I get this ugly illegal-property-value error as documented here: http://dev.jqueryui.com/ticket/4251. More relevantly, a good dozen of them aren't changing colors, even if changed to simply a single-color animate.

Fixing that line in the jquery.color.js and both FF3 and IE8 work like a charm, although IE8 white-screens, it recovers eventually.

jQuery is great for managing the DOM, not so great for effects. In my experience, the UI stuff is painful to use and has always had issues. The framework itself, though, has always treated me well.

Nathan
1% is just a rough estimate of the number of cells that miss changes in each animate. The jquery.color fix appears to have corrected this. I still don't exactly understand what's going on though, this being my second day with jquery. Does this code have some negative side effect? Why is it not in the official release?
recursive
Alright, well, for me it was more like 10%, but maybe it's just how slow my computer is.The change to the color addon says "initialize when uninitialized or at the beginning" instead of "initialize when at the beginning", which was a half-way-there thought process that clearly wasn't right. It is not part of the main library only because of the developers' decision to keep the jQuery footprint as small as possible (which is good!). The background color animate has been forward-ported into the newest jQuery UI, too, but both it and the color picker are "official" releases. It's kind of silly.
Nathan