javascript实现延时显示提示框效果
作者:CHC 时间:2024-04-25 13:10:42
js延时提示框效果演示:
实现方法
移入显示,移出隐藏
移除延时隐藏,可以实现从第一个div移入第二个div,仍然可以显示
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<style>
#div1 {
width: 50px;
height: 50px;
background: red;
float: left
}
#div2 {
margin-left: 10px;
width: 250px;
height: 150px;
background: yellow;
float: left;
display: none
}
</style>
<script>
window.onload=function()
{
var oDiv1=document.getElementById('div1');
var oDiv2=document.getElementById('div2');
var timer=null;
oDiv1.onmouseover=oDiv2.onmouseover=function()
{
clearTimeout(timer);
oDiv2.style.display='block';
};
oDiv1.onmouseout=oDiv2.onmouseout=function()
{
timer=setTimeout(function()
{
oDiv2.style.display='none';}
,500);
};
};
</script>
<body>
<div id="div1"></div>
<div id="div2"></div>
</body>
</html>
GitHub源码地址
标签:js,延时,提示框
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
SQL查询的底层运行原理深入分析
2024-01-21 04:43:49
Python实现OCR识别之pytesseract案例详解
2021-03-02 02:14:35
![](https://img.aspxhome.com/file/2023/2/94702_0s.png)
详解Vue中添加过渡效果
2024-04-27 16:04:29
![](https://img.aspxhome.com/file/2023/6/133016_0s.png)
SQL Server并行操作优化避免并行操作被抑制而影响SQL的执行效率
2024-01-23 10:55:50
![](https://img.aspxhome.com/file/2023/3/94423_0s.jpg)
Python轻松管理与操作文件的技巧分享
2021-11-19 14:42:12
解读ASP.NET 5 & MVC6系列教程(17):MVC中的其他新特性
2023-07-11 10:44:59
Python字符串中删除特定字符的方法
2023-07-25 18:58:54
![](https://img.aspxhome.com/file/2023/3/79473_0s.png)
一文理解MySQL数据库的约束与表的设计
2024-01-21 08:31:12
![](https://img.aspxhome.com/file/2023/2/70372_0s.png)
Python玩转Excel的读写改实例
2022-01-27 19:59:47
下载 Firefox 3 中文版/英文版
2008-06-19 13:27:00
![](https://img.aspxhome.com/file/UploadPic/20086/19/2008619133121666s.jpg)
sql server关键字详解大全(图文)
2024-01-14 09:43:13
![](https://img.aspxhome.com/file/2023/0/110980_0s.png)
python cv2图像质量压缩的算法示例
2023-08-16 19:09:02
![](https://img.aspxhome.com/file/2023/6/130966_0s.jpg)
Vue 页面监听用户预览时间功能的实现代码
2024-04-27 15:56:25
![](https://img.aspxhome.com/file/2023/8/133088_0s.png)
python实现简单ftp客户端的方法
2023-12-14 20:07:31
MySQL如何修改账号的IP限制条件详解
2024-01-14 19:41:59
![](https://img.aspxhome.com/file/2023/0/124880_0s.png)
jupyter notebook使用argparse传入list参数
2022-12-25 16:54:03
golang语言实现的文件上传与文件下载功能示例
2023-06-19 00:05:31
js中int和string数据类型互相转化实例
2024-05-02 17:25:57
Python缩进和冒号详解
2023-04-21 16:22:11
![](https://img.aspxhome.com/file/2023/1/78731_0s.png)
word-wrap同word-break的区别
2007-10-24 20:08:00