1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > JS实现响应鼠标点击动画渐变弹出层效果代码【javascript】

JS实现响应鼠标点击动画渐变弹出层效果代码【javascript】

时间:2023-10-22 10:30:59

相关推荐

JS实现响应鼠标点击动画渐变弹出层效果代码【javascript】

web前端|js教程

JS,响应,鼠标点击,动画渐变,弹出层

web前端-js教程

同城酒水配送源码,怎样复制ubuntu文件,控制台查tomcat进程,爬虫软件 单机,php程序设计难学吗,seo 常用网站lzw

动画弹出层.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;}

0

1

脚本之家

2

新浪搜狐

3

网页特效

var zindex=0; function $id(id){ return document.getElementById(id); } var Bind = function(object,fun){ var args = Array.prototype.slice.call(arguments).slice(2); return function(){ return fun.apply(object,args); } } 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;} } var Shower=function(){ this.list=null; ment=null; this.moveLeft=80; this.moveTop=20; this.height=150; this.width=250; this.time=800; this.init=function(lisObj,comObj){ this.list=lisObj; ment=comObj; var _this=this; this._fnMove=Bind(this,this.move); (function(){ var obj=_this; 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(!ment.style.display||ment.style.display=="none"){ ment.style.display="block"; ment.style.height=0+"px"; ment.style.width=0+"px"; _this.list.style.zIndex=++zindex; _this.list.className="listShow"; var comment=ment.innerHTML; ment.innerHTML=""; //去掉显示内容 var timer=setInterval(function(){ var newTime = new Date().getTime(); var timestamp = newTime - startTime; ment.style.left=Math.ceil(w)+"px"; ment.style.top=Math.ceil(h)+"px"; ment.style.height=height+"px"; ment.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);ment.style.left=_this.moveLeft+"px";ment.style.top=_this.moveTop+"px";ment.style.height=_this.height+"px";ment.style.width=_this.width+"px";ment.innerHTML=comment; //回复显示内容}},1,ment); }else{ _this.hidden(); }}this.hidden=function(){ var _this=this; var flag=1; var hiddenTimer=setInterval(function(){ if(flag==1){ ment.style.height=parseInt(ment.style.height)-10+"px"; }else{ ment.style.width=parseInt(ment.style.width)-15+"px"; ment.style.left=parseInt(ment.style.left)+5+"px"; } if(flag==1 && parseInt(ment.style.height)<10){ flag=-flag; } if(parseInt(ment.style.width)<20){ clearInterval(hiddenTimer); ment.style.left="0px"; ment.style.top="0px"; ment.style.height="0px"; ment.style.width="0px"; ment.style.display="none"; if(_this.list.style.zIndex==zindex){ zindex--; }; _this.list.style.zIndex=0; _this.list.className="list"; } },1) } } 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")); }更多关于JavaScript相关内容感兴趣的读者可查看本站专题:《JavaScript查找算法技巧总结》、《JavaScript动画特效与技巧汇总》、《JavaScript错误与调试技巧总结》、《JavaScript数据结构与算法技巧总结》、《JavaScript遍历算法与技巧总结》及《JavaScript数学运算用法总结》

网址导航源码哪里有卖,ubuntu点击安装卡死,在一个tomcat下跨域,免费爬虫ip代理,php函数的调用过程是什么,Seo169lzw

cocos2dx 斗地主源码,vscode背单词,ubuntu系统登陆FTP,tomcat清理项目,sqlite怎么连接vb,js遮罩层 插件,前端 客户端框架,scrapy爬虫运行步骤,centos php配置,南京seo见效付费,简易旅游网站源码,网页数据导入access,发卡平台模板,单页面电商建站系统,分享图书管理系统php代码,微擎小程序访问统计为0lzw

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。