Simple question, how would I accomplish this functionality in Jquery:
Test whether the mouse is hovering over .myBox
if ($(".myBox").mouseleave = true) {
DO SOMETHING
} else {something else}
OR
if ($(".myBox").mouseover = false) {
DO SOMETHING
} else {Something else}
NOTE: im looking for an IF statement
jQuery provides the
ismethod for checking conditions with regard to a jQuery object. In your case you can check for the:hoverCSS pseudo class:Havre a look at this demo, try clicking the button (which will alert
true) and the tabbing to and hitting enter on the button (without the mouse, it will returnfalse).DEMO: http://jsfiddle.net/marcuswhybrow/LL5JD/