Jquery effect problem : How to detect if mouseover is triggered by scroll ?

Posted by Crupuk on Stack Overflow See other posts from Stack Overflow or by Crupuk
Published on 2010-06-16T12:09:22Z Indexed on 2010/06/16 12:12 UTC
Read the original article Hit count: 245

Hello,

I have another problem, and because the reply is to fast here i come back again !!

I would like to use "key navigation" and for that, i use the keypress event with down/up key )

When my mouse is over a div (div who's contenaing a big table) and i pull the down key :

i scroll to next td + change css style + remove the current style

And again, for each event..

So, because my mouse is over the main div, each time i scroll (auto) to a element, the mouseover event is triggered ..

And so, the effect is missed..

This is the perfect script :

  • User use keyboard navigation : Mouseover is disabled (so style change only with up/down key)
  • User don't use keyboard : mouseover change the style

Could you help me ?

The code :

$("#content tr").mouseover(function() {
    $("#content tr.use,#content tr.sel").removeClass("use sel");
    $(this).addClass("sel");
});

And the keyboard navigation code : http://pastebin.com/Hgn5Y1FV

(Sorry again for my english.. )

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery