:hover
Pseudo-classYou can simply use the CSS :hover
pseudo-class selector in combination with the jQuery mousemove()
to check whether the mouse is over an element or not in jQuery.
The jQuery code in the following example will display a hint message on the web page when you place or remove the mouse pointer over the DIV element's box.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery Check If the Mouse is Over an Element</title>
<style>
div{
margin: 80px;
height: 200px;
background: orange;
}
</style>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$(document).ready(function(){
$(document).mousemove(function(){
if($("#myDiv:hover").length != 0){
$(".hint").text("Mouse is Over the DIV Element.");
} else{
$(".hint").text("Mouse is Outside the DIV Element.");
}
});
});
</script>
</head>
<body>
<div id="myDiv"></div>
<p class="hint"><!-- Hint text will be displayed here --></p>
</body>
</html>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on harsukh21@gmail.com
Laravel 7 Send Mail Using Markdown Example
Today, markdown laravel 7 mail is our ma...Stripe Payment Integration With Laravel 5.4
In this tutorial we are share with you h...Sending Telegram Notifications in Laravel
Telegram is a highly customizable,...Laravel 5.6 - RealTime CRUD System Using Google Firebase
Today, we are share with you how to buil...How to check whether a variable is empty in PHP
Use the PHP empty() function...