JQuery automatically executes when the mouse hovers over an area for 3 seconds

  • 2020-03-30 03:56:29
  • OfStack

This article mainly introduces the JQuery implementation that automatically executes when the mouse is hovering over an area for 3 seconds, which can be applied to many scenarios


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
</head>
<style type="text/css">
.main{width:500px;height:400px;border:dashed 1px #ccc;margin:0 auto;line-height:400px;text-align:center;}
</style>
<body>
<script type="text/javascript">
$(function(){
$(".main").mouseover(function(){
setTimeout(function(){
alert(' When your mouse moves over the frame, I delay 3 Seconds to show oh! ');
},3000)
});
})
</script>
<div class="main"> Move the mouse into the box and wait 3 Seconds. </div> 
 </body>
</html>

Related articles: