-2

I want to detect when the mouse is hovering over an element. Easy right? Wait, there's more

If I use, for an example, jQuery dialog, (have it up), and then exit the dialog with either enter or esc AND at the same time hover with the mouse over the element, (NOT MOVING THE MOUSE), that i want to detect hover on, it wont detect it, not untill i move the mouse.

How can you solve this?

Edit 1

Theres too much code too show but I will edit my question when i have more time.

What i basically have is a clickable div that shows color red when clicked. When a user clicks on that div the jquery dialog appears and the divs color change to red, note that i still have the div in red while the dialog is up. In my close event I remove the red color. BUT, If the user press ESC while hovering at that div location i dont want the red color to disappear..

So i want the divs color to disappear when the dialog is closed and IF the mouse isnt over that element. I also want the divs color to maintain that red color IF the mouse is over that hover element.

Atm when I hover over that element and when the dialog is up, and press ESC, the color disappears, which i dont want. If i then move my mouse slightly so that the mouseover event activates, the color changes...

Hope that calirfies what i want.. As I said ill edit with some code later..

Reft
  • 2,333
  • 5
  • 36
  • 64
  • 1
    Wow. I have no idea what you are asking :) Could you clarify with some code and a (non-)working example? – Turnip Jun 30 '14 at 18:46
  • Use the jQuery Dialog close callback method to invoke the OnMouseMove event. – mambrow Jun 30 '14 at 18:53
  • 1
    @3rror404 They want to know how to detect if a mouse is over an element. In this case, there isn't a mouse-in or mouse-out event because something happened onscreen without the user moving their mouse. – MiniRagnarok Jun 30 '14 at 18:54
  • I think I know what you are saying. Essentially, you want a hover event to trigger even if the mouse hasn't moved and you closed a jQuery dialog with esc/enter? Perhaps this will help: http://stackoverflow.com/questions/4925550/losing-hover-when-animating-with-jquery-without-moving-mouse. What code do you have so far? – Jason Jun 30 '14 at 18:55
  • @Jason thats exactly my problem! Good link, same problem as me. Gonna try to implement it in my own code! Thanks. Downvoter, why? You dont always have to include code in your questions. – Reft Jun 30 '14 at 19:51

1 Answers1

0

I wasn't able to validate if the mouse was hovering over the div while the dialog was up because the dialog element was ontop of every other element, (the entire screen is filled up). What I did was adding a delay in the close event that checked if the element was hovered on. So, the validate hover code was executed after the dialog window was closed.

Reft
  • 2,333
  • 5
  • 36
  • 64