JavaScript网页特效实例大全
源代码在线查看: 10-11.htm
ie=document.all
lshow=60
var move=10;
menuSpeed=40
var moveOnScroll=true
var tim;
var ltop;
function makeMenu(obj,nest){
this.css=eval(obj+'.style')
this.state=1
this.go=0
this.width=eval(obj+'.offsetWidth')
this.left=b_getleft
this.obj = obj + "Object";
eval(this.obj + "=this")
}
function b_getleft(){
var gleft=eval(this.css.pixelLeft);
return gleft;
}
function moveMenu(){
if(!oMenu.state){
clearTimeout(tim)
mIn()
}else{
clearTimeout(tim)
mOut()
}
}
function mIn(){
if(oMenu.left()>-oMenu.width+lshow){
oMenu.go=1
oMenu.css.left=oMenu.left()-move
tim=setTimeout("mIn()",menuSpeed)
}else{
oMenu.go=0
oMenu.state=1
}
}
function mOut(){
if(oMenu.left() oMenu.go=1
oMenu.css.left=oMenu.left()+move
tim=setTimeout("mOut()",menuSpeed)
}else{
oMenu.go=0
oMenu.state=0
}
}
function checkScrolled(){
if(!oMenu.go) oMenu.css.top=eval(scrolled)+ltop
}
function menuInit(){
oMenu=new makeMenu('divMenu')
oMenu.css.left=-oMenu.width+lshow
oMenu.css.visibility='visible'
}
onload=menuInit;
TOM-
新浪-
搜狐-
NBA-
JavaScript
--- 导航菜单