×

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

作者:Terry2017.02.05来源:Web前端之家浏览:12669评论:0
关键词:JQueryJS

这篇文章主要介绍了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>
<div class="main">把鼠标移入此框体中,等待3秒。</div> 
 </body>
</html>

您的支持是我们创作的动力!
温馨提示:本文作者系Terry ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://jiangweishan.com/article/svg1486224000773.html

网友评论文明上网理性发言 已有0人参与

发表评论: