PHP群:95885625 Hbuilder+MUI群:81989597 站长QQ:634381967
|
积分获取
|
给我留言
|
tag标签
首页
开发编程
PHP教程
ASP.NET教程
Jquery教程
Unity3D教程
JavaScript教程
HTML+CSS
ThinkPhp教程
Smarty教程
正则表达式
编程杂谈
HTML5+CSS3教程
HBuilderX教程
AngularJS教程
Laravel教程
iOS开发教程
Java教程
小程序开发
提供网页设计教程和后台编程技术
CMS教程
phpcms教程
dedecms教程
wordpress教程
ecshop教程
帝国cms教程
discuz教程
齐博cms教程
ShopNc教程
提供主流cms教程
数据库
MySQL教程
SQL Server教程
NoSql数据库
提供数据库教程和设计
JS特效
HTML5+CSS3特效
焦点图
菜单导航
广告特效
对联广告
在线客服
相册特效
图片特效
悬浮漂浮
滚动特效
Tab选项卡
瀑布流
手机js特效
弹出层(框)
日期时间
网页模板
其它特效
提供各种常见网页js代码
网页特效
HTML5+CSS3
鼠标特效
文字特效
导航菜单
表格图层
Tab选项卡
图片特效
时间日期
网站常用
提供常用的JS特效代码及在线演示
Jquery插件
jQuery日期时间
jQuery弹出层
jQuery筛选排序
jQuery滚动插件
jQuery工具提示
jQuery音频视频
jQuery选项卡
jQuery图片裁剪
jQuery常用插件
jQuery导航菜单
提供jQuery插件教程及插件下载
服务器
Linux教程
Web服务器
提供服务器常见问题及教程
站长学院
seo技巧
建站经验
网络营销
站长资讯
好文分享
网络推广
互联网资讯
提供站长技术、站长资讯等内容
工具&手册
Base64编码加密
正则测试工具
Css压缩/格式化
jQuery手册
md5加密
CSS3
帝国cms开发手册
DEDE5.7使用手册
配色词典
C语言库
提供常用开发手册和开发工具
全站搜索
搜索
关键字:
建议
隔行换色
菜单导航
代码特效
上传插件
编辑器
插入视频
个人站长
您现在的位置:
首页
>
网页特效
>
表格图层
> 正文
js实现简单漂亮弹出提示层网页特效
作者:admin
来源:
B5教程网
浏览:
次
时间:2020-10-24 21:11:49
我要评论
分享到
内容介绍
js实现简单漂亮弹出提示层网页特效,用户点击文字后弹出显示,当再次点击后图层隐藏,结合自己的网站需求来修改即可,需要的朋友可以做个参考。
www.bcty365.com,B5教程网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在B5教程网
<!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" /> <meta name="keywords" content="B5教程网,www.bcty365.com" /> <meta name="description" content="B5教程网,www.bcty365.com" /> <title>网页特效 简单漂亮弹出提示层特效 站长特效网_B5教程网</title> <style> .list{ position:relative;; background:#eee; border:1px #ccc solid; margin:10px; height:30px; width:100px; cursor :pointer ; } .listShow{ position:relative; background:#eff; border:1px #ddd solid; margin:10px; height:30px; width:100px; cursor :pointer ; } .comment{ position:absolute; left:0; display:none; position:absolute; border:1px #ccc solid; background:#fee; width:200px; height:200px; overflow:hidden; z-index:100; } </style> </head> <body> <div style=" clear:both; width:700px; margin:0 auto; text-align:center; font-size:14px; font-weight:bold; padding-top:10px;"> <p >代码整理:<a href="http://www.bcty365.com" title="B5教程网" style="color:#FF0000" alt="B5教程网">B5教程网</a></p> <p>*尊重他人劳动成果,转载请自觉注明出处!注:此代码仅供学习交流,请勿用于商业用途。</p> <p></p> </div> <div class="" id="show"> 0 </div> <div class="list" id="list1">1 点击此处 <div class="comment" id="comment1">B5教程网——www.bcty365.com 1<br/> B5教程网——www.bcty365.com 2<br/> B5教程网——www.bcty365.com 3<br/> B5教程网——www.bcty365.com 4<br/> B5教程网——www.bcty365.com 5</div> </div> <div class="list" id="list2">2 点击此处 <div class="comment" id="comment2">B5教程网——www.bcty365.com</div> </div> <div class="list" id="list3">3 点击此处 <div class="comment" id="comment3">B5教程网——www.bcty365.com</div> </div> <div class="list" id="list4">4 点击此处 <div class="comment" id="comment4">B5教程网——www.bcty365.com</div> </div> <div class="list" id="list5">5 点击此处 <div class="comment" id="comment5">B5教程网——www.bcty365.com</div> </div> <div class="list" id="list6">6 点击此处 <div class="comment" id="comment6">B5教程网——www.bcty365.com</div> </div> </body> </html> <script> var zindex=0; function $id(id){ return document.getElementById(id); } <!--www.bcty365.com,B5教程网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在B5教程网--> var Bind = function(object,fun){ var args = Array.prototype.slice.call(arguments).slice(2); return function(){ return fun.apply(object,args); } } <!--www.bcty365.com,B5教程网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在B5教程网--> function addEventHandler(oTarget, sEventType, fnHandler){ if(oTarget.addEventListener){oTarget.addEventListener(sEventType, fnHandler, false);} else if(oTarget.attachEvent){oTarget.attachEvent('on' + sEventType, fnHandler);} else{oTarget['on' + sEventType] = fnHandler;} } <!--www.bcty365.com,B5教程网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在B5教程网--> var Shower=function(){ this.list=null; this.comment=null; this.moveLeft=80; //弹出div的水平偏移距离 this.moveTop=20; //弹出div的竖直偏移距离 this.height=150; //弹出div的高 this.width=250; //弹出div的宽 this.time=800; //弹出div所用时间 this.init=function(lisObj,comObj){ this.list=lisObj; this.comment=comObj; var _this=this; this._fnMove=Bind(this,this.move); (function(){ var obj=_this; <!--www.bcty365.com,B5教程网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在B5教程网--> addEventHandler(obj.list,"click",obj._fnMove); })(); }; this.move=function(){ var _this=this; var w=0; //水平偏移 var h=0; //竖直偏移 var height=0; //弹出div的高 var width=0; //弹出div的宽 var t=0; var startTime = new Date().getTime();//开始执行的时间 if(!_this.comment.style.display||_this.comment.style.display=="none"){ _this.comment.style.display="block"; _this.comment.style.height=0+"px"; _this.comment.style.width=0+"px"; _this.list.style.zIndex=++zindex; _this.list.className="listShow"; var comment=_this.comment.innerHTML; _this.comment.innerHTML=""; //去掉显示内容 var timer=setInterval(function(){ var newTime = new Date().getTime(); var timestamp = newTime - startTime; _this.comment.style.left=Math.ceil(w)+"px"; _this.comment.style.top=Math.ceil(h)+"px"; _this.comment.style.height=height+"px"; _this.comment.style.width=width+"px"; t++; var change=(Math.pow((timestamp/_this.time-1), 3) +1); //根据运行时间得到基础变化量 w=_this.moveLeft*change; h=_this.moveTop*change; height=_this.height*change; width=_this.width*change; $id("show").innerHTML=w; if(w>_this.moveLeft){ clearInterval(timer); _this.comment.style.left=_this.moveLeft+"px"; _this.comment.style.top=_this.moveTop+"px"; _this.comment.style.height=_this.height+"px"; _this.comment.style.width=_this.width+"px"; _this.comment.innerHTML=comment; //回复显示内容 } },1,_this.comment); }else{ _this.hidden(); } } this.hidden=function(){ var _this=this; var flag=1; var hiddenTimer=setInterval(function(){ if(flag==1){ _this.comment.style.height=parseInt(_this.comment.style.height)-10+"px"; }else{ _this.comment.style.width=parseInt(_this.comment.style.width)-15+"px"; _this.comment.style.left=parseInt(_this.comment.style.left)+5+"px"; } if(flag==1 && parseInt(_this.comment.style.height)<10){ flag=-flag; } if(parseInt(_this.comment.style.width)<20){ clearInterval(hiddenTimer); _this.comment.style.left="0px"; _this.comment.style.top="0px"; _this.comment.style.height="0px"; _this.comment.style.width="0px"; _this.comment.style.display="none"; if(_this.list.style.zIndex==zindex){ zindex--; }; _this.list.style.zIndex=0; _this.list.className="list"; } },1) } } <!--www.bcty365.com,B5教程网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在B5教程网--> window.onload=function(){ //建立各个菜单对象 var shower1=new Shower(); shower1.init($id("list1"),$id("comment1")); var shower2=new Shower(); shower2.init($id("list2"),$id("comment2")); var shower3=new Shower(); shower3.init($id("list3"),$id("comment3")); var shower4=new Shower(); shower4.init($id("list4"),$id("comment4")); var shower5=new Shower(); shower5.init($id("list5"),$id("comment5")); var shower6=new Shower(); shower6.init($id("list6"),$id("comment6")); } <!--www.bcty365.com,B5教程网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在B5教程网--> </script>
本站所有特效都是站长亲自测试后发布的,如果运行代码无效果,请复制到您的本机运行
运行代码
复制代码
另存代码
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
转载请注明(B5教程网)原文链接::
https://b5.mxunkeji.com/content-77-69-1.html
相关热词搜索:
js特效代码
网页特效
提示层
弹出层
上一篇:
jquery实现鼠标经过文字弹出提示层渐隐效果
下一篇:
Js代码动态移动、拖动浮层并关闭
最新推荐
[
网络推广
]
24h无人值守共享自助洗车解
[
网络推广
]
微信小程商家wifi码是什么?
[
网络推广
]
企业光伏数据对接碳达峰系统
[
互联网资讯
]
CentOS官方已计划停止维护Ce
[
PHP教程
]
PHP 主力开发因生活压力不
[
网络营销
]
抖音自动关注、自动点赞、自
[
网络推广
]
阿里云优惠券|阿里云代金券|
[
网络推广
]
阿里云 ECS实例升级、续费
[
互联网资讯
]
我名下有几张移动电话卡?有
[
互联网资讯
]
互联网平台相互屏蔽网址链接
本周排行
[
表格图层
]
Js代码动态移动、拖动浮层并关闭
[
表格图层
]
点击按钮弹出居中遮罩图层
[
表格图层
]
jquery实现表格颜色隔行换色特效
[
表格图层
]
jquery实现鼠标经过文字弹出提示层渐隐效果
[
表格图层
]
js实现简单漂亮弹出提示层网页特效
关于我们
关于我们
赞助我们
加入我们
版权声明
联系我们
联系我们
QQ技术群
合作方式
广告服务
业务合作
常见问题
意见反馈
网站地图
在线投稿
积分获取
在线充值
本站不承担任何版权问题,如果我们侵犯了您的利益,请来信
告知(634381967@qq.com),我们会在第一时间处理!
© 苏ICP备20040182号
B5教程网 版权所有