SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: if mouseover

  1. #1
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    if mouseover

    Is there a way to identify if a mouse is hovering over an object? (as an if statement, not onmouseover of course)

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use a global variable along with onmouseover and onmouseout and then query that to see if the mouse is over the object:

    var overMyDiv = false;

    function something() {
    if( overMyDiv ) {
    //do something
    }
    }

    ...

    <div onmouseover="overMyDiv=true;" onmouseout="overMyDiv=false;">
    something
    </div>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •