无为清净楼资源网 Design By www.qnjia.com

谁在用这些导航
google是个大公司,全世界都有google的脚印,韩国的google动画效果非常不错,蓝色理想论坛里已经有人挖过来了,可惜js写的太多了,那自己写一个吧"font-size: medium">原理
小时候,总喜欢看动画片吧,动画片是怎样实现的呢"font-size: medium">准备
我们需要一张图片,一个大脑,一张会笑的脸(不笑效果就出不来了….)!!下面是我准备的图片(ps水平有限^_^)…
用javascript来实现动画导航效果的代码
代码

我们看到上面的图片,想象下,它动起来是多么的优美啊…

css
复制代码 代码如下:

.Gnb_btn_div{ 
    width:90px; 
    height:75px; 
    overflow:hidden; 
    display:block; 
    position:absolute; 
}      

.Gnb_btn_img{ 
    width:100%; 
    height:525px; 
    display:block; 
    overflow:hidden; 
    text-indent:-500px; 

#gnb_btn_01 .Gnb_btn_img { 
    background-image:url(http://www.wler.cn/blog/img/friend.gif) 
}

javascript

复制代码 代码如下:
<script type="text/javascript"> 
// <![CDATA[ 
function GNB(_7c){ 
    //初始化一些参数 
    this.iImgNum=7;            //小图片个数 
    this.iImgHeight=75;        //小图片高度 
    this.iOverSpeed=50;        //鼠标经过时候切换的时间 
    this.iOutSpeed=50;        //鼠标离开时候切换的时间 
    this.eventObj=_7c;        //取得图片对象      

    this.MouseOverFlag=false; 
    this.imageIndex=0; 
    if(this.eventObj==null){return;} 
    this.eventObj.parentClass=this;this.eventAssign(); 
}      

GNB.prototype.eventAssign=function(){//注册事件 
    this.eventObj.onmouseover=this.menuMouseOver; 
    this.eventObj.onmouseout=this.menuMouseOut; 
};      

GNB.prototype.menuMouseOver=function(){//鼠标经过 
    if(this.parentClass.MouseOverFlag!=false){return;} 
    this.parentClass.MouseOverFlag=true; 
    this.parentClass.clearTimeOut(); 
    this.parentClass.menuMouseOverTimer(); 
};      

GNB.prototype.menuMouseOut=function(){//鼠标离开 
    this.parentClass.MouseOverFlag=false; 
    this.parentClass.clearTimeOut(); 
    this.parentClass.menuMouseOutTimer(); 
};      

GNB.prototype.menuMouseOverTimer=function(){//经过图片位置递增 
    var _7d=this; 
    if(this.imageIndex>=this.iImgNum){return;} 
    this.eventObj.scrollTop=this.imageIndex*this.iImgHeight; 
    this.imageIndex++; 
    this.setTimerID=setTimeout(function(){_7d.menuMouseOverTimer();},this.iOverSpeed); 
};      

GNB.prototype.menuMouseOutTimer=function(){////经过图片位置递减 
    var _7e=this;if(this.imageIndex<0){return;} 
    this.eventObj.scrollTop=this.imageIndex*this.iImgHeight; 
    this.imageIndex--; 
    this.setTimerID=setTimeout(function(){_7e.menuMouseOutTimer();},this.iOutSpeed); 
};      

GNB.prototype.clearTimeOut=function(){//取消定时 
    clearTimeout(this.setTimerID); 
}; 
// ]]> 
</script>

xhtml
复制代码 代码如下:

<div class="Gnb_btn_div" id="gnb_btn_01"> 
<a class="Gnb_btn_img" href="#1" href="#1">找朋友</a> 
</div>      

<script type="text/javascript"> 
// <![CDATA[ 
var GNB1=new GNB(document.getElementById("gnb_btn_01"));//实例单个按钮,当然也可以多个 
// ]]> 
</script>

演示地址

标签:
javascript,动画导航效果

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。