0

On my website I have 3 sections in the content area. Those have CSS3 animations and stuff going on when a user hovers the mouse.

Now, I thought it might be a good idea to have the same effect going on when users hover the menu items (it is a landing page so basically the menu items have anchors on them, etc)

I was able to use hover() method but all that enabled me was adding/removing classes.

My question is: Is there any way jQuery is able to cause the native hover on an element (the elements are not related, that is, truly hovered item is a nav item, and the other is a section in the page content).

developer10
  • 1,450
  • 2
  • 15
  • 31
  • I don't think so. you'll have to do the stuff in css `:hover` selector in a js function… Even if you manage to trigger hover on other elements, won't that be momentary..? or will you keep on triggering hover in a loop or interval as long as on item is hovered..? `add/remove` classes instead. – T J Jul 15 '14 at 07:04
  • 4
    see this : [dup](http://stackoverflow.com/questions/2290829/how-to-force-a-hover-state-with-jquery) – ConductedClever Jul 15 '14 at 07:06
  • Yep, I just accompanied my existing `:hover` CSS declarations with `.xyz.hovered` (comma separated, obviously) for each element that needed it and it works. – developer10 Jul 15 '14 at 07:55
  • 1
    @ConductedClever Please move your comment into an answer (even though it's just pointing to another questions) so I can mark it accepted! – developer10 Jul 15 '14 at 07:56
  • and now i wait for your acceptance! – ConductedClever Jul 15 '14 at 08:23

1 Answers1

0

Your question is already answered.

try this :

$("#btn").click(function() {
   $("#link").trigger("hover");
});

see the full answer here :

answer

Community
  • 1
  • 1
ConductedClever
  • 4,175
  • 2
  • 35
  • 69
  • 1
    You should mark this as a duplicate instead of copying the answer from the other question. – Ruddy Jul 15 '14 at 08:24