dedecms怎么做下拉菜單

dedecms怎么做下拉菜單

dedecms做下拉菜單:

將下面這段代碼貼到templetsdefaultfooter.htm文件里

<!-- //二級子類下拉菜單,考慮SEO原因放置于底部 --> ????<script></script> ????{dede:channelartlist?typeid='top'?cacheid='channelsonlist'} ????
    ????????{dede:channel?type=’son’?noself=’yes’} ????????

  • [field:typename/]
  • ????????{/dede:channel} ????

????{/dede:channelartlist} ????<script>cssdropdown.startchrome("navMenu")</script>

以上代碼可以看出,二級子類下拉菜單是由dropdown.js控制的,我們來看dropdown.js文件:

由以上的cssdropdown.startchrome(“navMenu”),可以看出我們調用的是 ?startchrome:function()

var?cssdropdown={ disappeardelay:?250,? disablemenuclick:?false,? enableswipe:?1,? enableiframeshim:?1,? dropmenuobj:?null,?ie:?document.all,?firefox:?document.getElementById&amp;&amp;!document.all,?swipetimer:?undefined,?bottomclip:0, ? getposOffset:function(what,?offsettype){ var?totaloffset=(offsettype=="left")??what.offsetLeft?:?what.offsetTop; var?parentEl=what.offsetParent; while?(parentEl!=null){ totaloffset=(offsettype=="left")??totaloffset+parentEl.offsetLeft?:?totaloffset+parentEl.offsetTop; parentEl=parentEl.offsetParent; } return?totaloffset; }, ? swipeeffect:function(){ if?(this.bottomclip<parseint this.bottomclip this.dropmenuobj.style.clip="rect(0?auto?" else return this.swipetimer='setTimeout("cssdropdown.swipeeffect()",?10)' showhide:function if this.dropmenuobj.style.left='this.dropmenuobj.style.top="-500px"' cleartimeout obj.clip="rect(0?auto?0?0)" this.swipeeffect obj.visibility="visible" iecompattest:function clearbrowseredge:function var this.dropmenuobj.contentmeasure="this.dropmenuobj.offsetWidth" edgeoffset="this.dropmenuobj.contentmeasure-obj.offsetWidth" dropit:function this.dropmenuobj.style.visibility="hidden" this.clearhidemenu obj. this.dropmenuobj="document.getElementById(dropmenuID)" this.dropmenuobj. this.showhide this.dropmenuobj.x='this.getposOffset(obj,?"left")' this.dropmenuobj.y='this.getposOffset(obj,?"top")' this.dropmenuobj.style.top='this.dropmenuobj.y-this.clearbrowseredge(obj,?"bottomedge")+obj.offsetHeight+1+"px"' this.positionshim positionshim:function this.shimobject.style.width='this.dropmenuobj.offsetWidth+"px"' this.shimobject.style.height='this.dropmenuobj.offsetHeight+"px"' this.shimobject.style.left="this.dropmenuobj.style.left" this.shimobject.style.top="this.dropmenuobj.style.top" this.shimobject.style.display='(this.dropmenuobj.style.visibility=="visible")??"block"?:?"none"' hideshim:function contains_firefox:function while dynamichide:function this.delayhidemenu delayhidemenu:function this.delayhide="setTimeout(&quot;cssdropdown.dropmenuobj.style.visibility='hidden';?cssdropdown.hideshim()&quot;,this.disappeardelay)?" clearhidemenu:function startchrome:function for menuitems cssdropdown.dropit document.write>') this.shimobject=document.getElementById("iframeshim")? } } }</parseint>

由上可以看出,var cssdropdown變量中有多個函數:

getposOffset:function(what,?offsettype) swipeeffect:function() showhide:function(obj,?e)? iecompattest:function() clearbrowseredge:function(obj,?whichedge) dropit:function(obj,?e,?dropmenuID) positionshim:function() hideshim:function() dynamichide:function(e) delayhidemenu:function() clearhidemenu:function() startchrome:function()

更新一下!會發現導航欄已經出現下拉菜單了,只是背景是透明的,原因是沒有背景圖片。

dedecms怎么做下拉菜單

然后我們可以對此下拉菜單添加背景圖片和設置css樣式。

推薦:dedecms使用教程

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊7 分享