I have this piece of jQuery code:
If the element with the id "slider" is being hovered on it should output "hovering" in the console, but even if I don't hover over it it still outputs "hovering".
Is there something wrong in the code?
JavaScript:
if ($("#slider:hover")) {
console.log("hovering");
}
else {
console.log("not hovering");
}
If the element with the id "slider" is being hovered on it should output "hovering" in the console, but even if I don't hover over it it still outputs "hovering".
Is there something wrong in the code?