首页 >

javascript制作的滑动图片菜单【javascript】

web前端|js教程javascript制作的滑动图片菜单【javascript】
javascript,滑动图片菜单
web前端-js教程
方法很简单,特效非常棒,这里就先不多废话了,直接上代码
flash 音乐频谱播放器源码 下载,vscode输出窗口不显示,ubuntu装deb,tomcat关闭目录,爬虫宠物吧,php控制nginx,濮阳seo推广方法有哪些,如何下载别人网站的核心源码,移动端二次元网站模板lzw
js滑动菜单* {margin:0; padding:0}.sm {list-style:none; width:459px; height:100px; display:block; overflow:hidden}.sm li {float:left; display:inline; overflow:hidden}var slideMenu=function(){var sp,st,t,m,sa,l,w,sw,ot;return{build:function(sm,sw,mt,s,sl,h){sp=s; st=sw; t=mt;m=document.getElementById(sm);sa=m.getElementsByTagName('li');l=sa.length; w=m.offsetWidth; sw=w/l;ot=Math.floor((w-st)/(l-1)); var i=0;for(i;i<l;i++){s=sa[i]; s.style.width=sw+'px'; this.timer(s)}if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)}},timer:function(s){s.onmouseover=function(){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}},slide:function(s){var cw=parseInt(s.style.width,'10');if(cw<st){var owt=0; var i=0;for(i;iot){oi=Math.floor((ow-ot)/sp); oi=(oi>0)?oi:1; o.style.width=(ow-oi)+'px'}owt=owt+(ow-oi)}}s.style.width=(w-owt)+'px';}else{clearInterval(m.timer)}}};}();
再来一个网友实现的滑动菜单特效
java简单oa系统源码,ubuntu 查看库函数,tomcat9.0启动不,牛客爬虫,php加密代码怎么解除,丘北seolzw
js十分好看的滑动菜单效果。body{ margin:10px; padding:10px;}a:link { text-decoration: none;color: blue}a:active { text-decoration:blink}a:hover { text-decoration:underline;color: red}a:visited { text-decoration: none;color: green}body,td,div,span,li{ font-size:12px;}.title01,.title02{ color:#00b; font-weight:bold;}#DoorP{ width:200px; height:300px; padding:0px; background:#FFFCF2; overflow:hidden;}.title01{ width:100%; height:25px; background:#FFFCF2; cursor:pointer;}.title02{ width:100%; height:25px; background:#FFFCF2; cursor:pointer;}.zzjs__net{ background:#FFFCF2; border-bottom:2px solid #fff; overflow:hidden; color:#666; padding-left:4px; padding-right:4px; line-height:18px;}.www_zzjs_net { width:202px; }.www_zzjs_net .b1, .www_zzjs_net .b2, .www_zzjs_net .b3, .www_zzjs_net .b4 { font-size:1px; display:block; background:#FFFCF2;overflow: hidden;}.www_zzjs_net .b1, .www_zzjs_net .b2, .www_zzjs_net .b3 { height:1px; }.www_zzjs_net .b2, .www_zzjs_net .b3, .www_zzjs_net .b4 { background:#FFFCF2; border-left:1px solid #C7BC98; border-right:1px solid #C7BC98; }.www_zzjs_net .b1 { margin:0 4px; background:#C7BC98; }.www_zzjs_net .b2 { margin:0 2px; border-width:0 2px; }.www_zzjs_net .b3 { margin:0 1px; }.www_zzjs_net .b4 { height:2px; margin:0; }.www_zzjs_net .c1 { margin:0 5px; background:#C7BC98; }.www_zzjs_net .c2 { margin:0 3px; border-width:0 2px; }.www_zzjs_net .c3 { margin:0 2px; }.www_zzjs_net .c4 { height:2px; margin: 0 1px; }.www_zzjs_net .zzjs_net { display:block; background:transparent; border-left:1px solid #C7BC98; border-right:1px solid #C7BC98; font-size:0.9em; text-align:justify; }
一号菜单
一号分类
二号分类
三号分类
二号菜单
四号分类
五号分类
六号分类
三号菜单
七号分类
八号分类
九号分类
var open = 2; var openState = new Array(); var closeState = new Array(); var dH = 220; function $(id){ if(document.getElementById(id)) { return document.getElementById(id); } else { alert("没有找到!"); } } function $tag(id,tagName){ return $(id).getElementsByTagName(tagName) } function closeMe(Cid,Oid){ var h = parseInt(Ds[Cid].style.height); //alert(h); if(h > 2) { h = h - Math.ceil(h/3); Ds[Cid].style.height = h+"px"; } else { openMe(Oid); clearTimeout(closeState[Cid]); return false; } closeState[Cid] = setTimeout("closeMe("+Cid+","+Oid+")"); } function openMe(Oid){ var h = parseInt(Ds[Oid].style.height); //alert(h); if(h < dH) { h = h + Math.ceil((dH-h)/3); Ds[Oid].style.height = h+"px"; } else { clearTimeout(openState[Oid]); return false; } openState[Oid] = setTimeout("openMe("+Oid+")"); } var Ds = $tag("DoorP","div"); var Ts = $tag("DoorP","table"); if(Ds.length != Ts.length) { alert("标题和内容数目不相同!"); } for(var i = 0 ; i < Ds.length ; i++) { if(i==open) { Ds[i].style.height = dH+"px"; Ts[i].className="title01"; } else { Ds[i].style.height = "0px"; Ts[i].className="title02"; } Ts[i].value = i; Ts[i].onmouseover = function(){ if(open==this.value) { return false; } Ts[open].className="title02"; Ts[this.value].className="title01"; for(var i = 0 ; i < openState.length ; i++) { clearTimeout(openState[i]); clearTimeout(closeState[i]); } closeMe(open,this.value); //openMe(this.value); open = this.value; } } function showDiv(id){ Ds[id].style.height=dH+"px"; Ds[open].style.height="0px"; open = id; }
以上所述就是本文的全部内容了,希望大家能够喜欢。
博客网站源码支持手机,ubuntu 关机会重启,tomcat应用服务端口,公众号资源爬虫,php技术的工作原理教程,界首seo服务lzw

  • 暂无相关文章