【www.gdgbn.com--php常用代码】
www.111cn.net 中国WEB第一站<script type="text/javascript"> /** *glide.layerGlide((oEventCont,oSlider,sSingleSize,sec,fSpeed,point); *@param auto type:bolean 是否自动滑动 当值是true的时候 为自动滑动 *@param oEventCont type:object 包含事件点击对象的容器 *@param oSlider type:object 滑动对象 *@param sSingleSize type:number 滑动对象里单个元素的尺寸(width或者height) 尺寸是有point 决定 *@param second type:number 自动滑动的延迟时间 单位/秒 *@param fSpeed type:float 速率 取值在0.05--1之间 当取值是1时 没有滑动效果 *@param point type:string left or top */ var glide =new function(){ function $id(id){return document.getElementById(id);}; this.layerGlide=function(auto,oEventCont,oSlider,sSingleSize,second,fSpeed,point){ var oSubLi = $id(oEventCont).getElementsByTagName("li"); var interval,timeout,oslideRange; var time=1; var speed = fSpeed var sum = oSubLi.length; var a=0; var delay=second * 1000; var setValLeft=function(s){ return function(){ oslideRange = Math.abs(parseInt($id(oSlider).style[point])); $id(oSlider).style[point] =-Math.floor(oslideRange+(parseInt(s*sSingleSize) - oslideRange)*speed) +"px"; if(oslideRange==[(sSingleSize * s)]){ clearInterval(interval); a=s; } } }; var setValRight=function(s){ return function(){ oslideRange = Math.abs(parseInt($id(oSlider).style[point])); $id(oSlider).style[point] =-Math.ceil(oslideRange+(parseInt(s*sSingleSize) - oslideRange)*speed) +"px"; if(oslideRange==[(sSingleSize * s)]){ clearInterval(interval); a=s; } } } function autoGlide(){ for(var c=0;c[(sSingleSize * i)]){ interval = setInterval(setValLeft(i),time); this.onmouseout=function(){if(auto){timeout = setTimeout(autoGlide,delay);};}; }else if(Math.abs(parseInt($id(oSlider).style[point]))<[(sSingleSize * i)]){ interval = setInterval(setValRight(i),time); this.onmouseout=function(){if(auto){timeout = setTimeout(autoGlide,delay);};}; } } })(i) } } } glide.layerGlide(true,"icon_num","show_pic",610,2,0.1,"left"); </script>
本文来源:http://www.gdgbn.com/jiaocheng/22755/