dedecms怎麼做下拉式選單
dedecms做下拉式選單:
#將下面這段程式碼貼到templets\default\footer.htm檔案裡
<!-- //二级子类下拉菜单,考虑SEO原因放置于底部 --> <script type='text/javascript' src='{dede:global.cfg_cmsurl/}/images/js/dropdown.js'></script> {dede:channelartlist typeid='top' cacheid='channelsonlist'} <ul id="dropmenu{dede:field.typeid/}" class="dropMenu"> {dede:channel type='son' noself='yes'} <li><a href="[field:typelink/]">[field:typename/]</a></li> {/dede:channel} </ul> {/dede:channelartlist} <script type="text/javascript">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&&!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.dropmenuobj.offsetHeight)){ this.bottomclip+=10+(this.bottomclip/10) this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)" } else return this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10) }, showhide:function(obj, e){ if (this.ie || this.firefox) this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px" if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){ if (this.enableswipe==1){ if (typeof this.swipetimer!="undefined") clearTimeout(this.swipetimer) obj.clip="rect(0 auto 0 0)" this.bottomclip=0 this.swipeeffect() } obj.visibility="visible" } else if (e.type=="click") obj.visibility="hidden" }, iecompattest:function(){ return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body }, clearbrowseredge:function(obj, whichedge){ var edgeoffset=0 if (whichedge=="rightedge"){ var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15 this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure) edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth } else{ var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18 this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge } } return edgeoffset }, dropit:function(obj, e, dropmenuID){ if (this.dropmenuobj!=null) this.dropmenuobj.style.visibility="hidden" this.clearhidemenu() if (this.ie||this.firefox){ obj.οnmοuseοut=function(){cssdropdown.delayhidemenu()} obj.οnclick=function(){return !cssdropdown.disablemenuclick} this.dropmenuobj=document.getElementById(dropmenuID) if(!this.dropmenuobj) return; this.dropmenuobj.οnmοuseοver=function(){cssdropdown.clearhidemenu()} this.dropmenuobj.οnmοuseοut=function(e){cssdropdown.dynamichide(e)} this.dropmenuobj.οnclick=function(){cssdropdown.delayhidemenu()} this.showhide(this.dropmenuobj.style, e) this.dropmenuobj.x=this.getposOffset(obj, "left") this.dropmenuobj.y=this.getposOffset(obj, "top") this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px" this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px" this.positionshim() } }, positionshim:function(){ if (this.enableiframeshim && typeof this.shimobject!="undefined"){ if (this.dropmenuobj.style.visibility=="visible"){ 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(){ if (this.enableiframeshim && typeof this.shimobject!="undefined") this.shimobject.style.display='none' }, contains_firefox:function(a, b) { while (b.parentNode) if ((b = b.parentNode) == a) return true; return false; }, dynamichide:function(e){ var evtobj=window.event? window.event : e if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement)) this.delayhidemenu() else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget)) this.delayhidemenu() }, delayhidemenu:function(){ this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) }, clearhidemenu:function(){ if (this.delayhide!="undefined") clearTimeout(this.delayhide) }, startchrome:function(){ for (var ids=0; ids<arguments.length; ids++){ var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a") for (var i=0; i<menuitems.length; i++){ if (menuitems[i].getAttribute("rel")){ var relvalue=menuitems[i].getAttribute("rel") menuitems[i].οnmοuseοver=function(e){ var event=typeof e!="undefined"? e : window.event cssdropdown.dropit(this,event,this.getAttribute("rel")) } } } } if (window.createPopup && !window.XmlHttpRequest){ document.write('<IFRAME id="iframeshim" src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>') this.shimobject=document.getElementById("iframeshim") } } }
從上可以看出,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()
更新一下!會發現導覽列已經出現下拉式選單了,只是背景是透明的,原因是沒有背景圖片。
然後我們可以對此下拉選單新增背景圖片和設定css樣式。
推薦:dedecms使用教學
#以上是dedecms怎麼做下拉式選單的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

帝國CMS模板下載位置:官方模板下載:https://www.phome.net/template/第三方模板網站:https://www.dedecms.com/diy/https://www.0978.com.cn /https://www.jiaocheng.com/安裝方式:下載模板解壓縮模板上傳模板選擇模板

在 Dedecms 中實作範本替換可以透過以下步驟:修改 global.cfg 文件,設定所需的語言包。修改 taglib.inc.php 鉤子文件,加入對語言後綴模板文件的支援。建立帶有語言後綴的新模板文件,修改所需內容。清除 Dedecms 快取。

如何使用 Dedecms 上傳本機影片?準備影片文件,確保格式符合 Dedecms 支援的格式。登入 Dedecms 管理後台,建立新的影片分類。在影片管理頁面上傳影片文件,填寫相關資訊並選擇影片分類。在編輯文章時嵌入視頻,輸入上傳視頻的文件名並調整尺寸。

Dedecms是一款開源CMS,可用於創建各種類型的網站,包括:新聞網站部落格網站電商網站論壇和社群網站教育網站入口網站其他類型的網站(例如企業網站、個人網站、相簿網站、影片分享網站)

DedeCMS是一個開源的內容管理系統,會存在一些潛在的漏洞和安全風險:1、SQL注入漏洞,攻擊者可以透過建構惡意的SQL查詢語句來執行未經授權的操作或取得敏感資料;2、文件上傳漏洞,攻擊者可以上傳包含惡意程式碼的檔案到伺服器上,從而執行任意程式碼或取得伺服器權限;3、敏感資訊外洩;4、未經身份驗證的漏洞利用。

Dedecms 是一款開源中文 CMS 系統,提供內容管理、模板系統和安全保護等功能。具體使用方法包含以下步驟:1. 安裝 Dedecms。 2. 配置資料庫。 3. 登入管理介面。 4. 創建內容。 5. 設定模板。 6. 管理用戶。 7. 維護系統。

在 DedecMS 中實現模版替換,需執行下列步驟:決定要替換的模版文件,常見的文件有 index.htm、list.htm 和 show.htm。建立新的模版文件,保留 DedecMS 標記。上傳新模版文件,覆蓋原始文件。清除快取。刷新網站以查看更改。

精準可靠的dedecms轉換工具評測報告隨著網路時代的快速發展,網站建置已成為許多企業和個人必備的工具之一。在網站建置中,使用內容管理系統(CMS)可以更方便有效率地管理網站內容和功能。其中,dedecms作為一款知名的CMS系統,被廣泛應用於各種網站建置專案中。然而,有時候我們會面臨著需要將dedecms網站轉換為其他格式的需求,這時就需要用到轉換工具
