从百度扒下来的竖直伸缩菜单-www.jb51.net 新手入门 关于百度搜索推广 账户注册 快速上手 推广制作 设置匹配方式 撰写创意 设置URL 推广投放 点击过滤 质量度 关键词匹配 创意展现方式 效果评估 推广效果 百度Bridge 持续优化 网站优化 增值产品 百度推广助手 营销中心 关注焦点 推广专题 var MENU_ID="MenuContainer";var MENU_LINK_PREFIX="./?module=default&controller=index&action=node&nodeid=";var SUB_ITEM_HEIGHT=27;function G(A){return document.getElementById(A)}var menuOnshow;function initMenu(){try{if(window.ActiveXObject&&!window.isopera){document.execCommand("BackgroundImageCache",false,true)}}catch(F){}var C=G(MENU_ID).getElementsByTagName("h4");for(var D=0,B=C.length;D<B;D++){var E=C[D];if(E.className!="current"){E.onclick=menuClickHandler}if(E.className=="expand"){var A=getMenuContainer(E);if(A.getElementsByTagName("p").length>0){menuOnshow=E;A.style.display=""}}}}function getMenuContainer(B){var A=B.nextSibling;while(A.nodeType!=1){A=A.nextSibling}return A}function menuClickHandler(I){if(isOnTweening){return }var D=getMenuContainer(this);var C=D.getElementsByTagName("p").length;if(C<=0){top.location=MENU_LINK_PREFIX+this.getAttribute("nodeid");return }if(this!=menuOnshow){var B;var E=G(MENU_ID).getElementsByTagName("h4");for(var F=0,A=E.length;F<A;F++){var H=E[F];if(H.className=="expand"&&getMenuContainer(H).getElementsByTagName("p").length>0){B=H;break}}menuOnshow=this;if(B){Queue.add(showSubMenu,this)}else{Queue.add(showSubMenu,this)}}else{Queue.add(hideSubMenu,this);menuOnshow=null}Queue.trigRun()}function showSubMenu(C){var B=C.nextSibling;while(B.nodeType!=1){B=B.nextSibling}if(B.style.display!="none"){return }var A=B.getElementsByTagName("p").length;var D=A*SUB_ITEM_HEIGHT;C.className="expand";tween(B,0,D)}function hideSubMenu(B){var A=B.nextSibling;while(A.nodeType!=1){A=A.nextSibling}if(A.style.display=="none"){return }var C=A.offsetHeight;B.className="";tween(A,C,0)}var Queue={list:[],add:function(A,B){Queue.list.push({fn:A,tar:B})},trigRun:function(){var A=Queue.list.shift();if(A){onTweenFinished=Queue.trigRun;A.fn(A.tar)}}};var tweenCurrentStep,tweenEl,tweenBegin,tweenEnd,tweenOffset,tweenInterval;var tweenStep=5,isOnTweening=0;var onTweenFinished;function tween(C,B,A){if(isOnTweening){return }tweenEl=C;tweenBegin=B;tweenEnd=A;tweenOffset=A-B;tweenCurrentStep=0;tweenEl.style.display="";tweenEl.style.height=tweenBegin+"px";isOnTweening=1;tweenInterval=setInterval(onTweenStep,10)}function onTweenStep(){tweenCurrentStep++;if(tweenStep<=tweenCurrentStep){afterTween();return }var A=Math.floor(tweenOffset*easeOut(tweenCurrentStep,tweenStep));tweenEl.style.height=tweenBegin+A+"px"}function afterTween(){tweenEl.style.height="";if(tweenEnd==0){tweenEl.style.display="none"}clearInterval(tweenInterval);tweenInterval=null;tweenEl=null;isOnTweening=0;if(onTweenFinished){var A=onTweenFinished;onTweenFinished=null;A()}}function easeOut(A,B){var C=A/B;return -C*(C-2)}initMenu(); [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]