当前位置: 移动技术网 > IT编程>开发语言>JavaScript > JQuery实现当鼠标停留在某区域3秒后自动执行

JQuery实现当鼠标停留在某区域3秒后自动执行

2019年03月26日  | 移动技术网IT编程  | 我要评论

这篇文章主要介绍了jquery实现当鼠标停留在某区域3秒后自动执行,可以应用于很多场景

<!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('当你的鼠标移动到框体时,我会延迟3秒才显示哦!');
},3000)
});
})
</script>
<p class="main">把鼠标移入此框体中,等待3秒。</p> 
 </body>
</html>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网