在Discuz X2.0版本下测试无错位,下拉菜单文字三个字情况下在IE7和火狐浏览器下显示无措。
打开论坛当前风格头部文件header.htm。
查找一下代码位置:
- <h2><!--{if !isset($_G['setting']['navlogos'][$mnid])}--><a href="./" title="$_G['setting']['bbname']">{$_G['style']['boardlogo']}</a><!--{else}-->$_G['setting']['navlogos'][$mnid]<!--{/if}--></h2>
在上面查找的代码下面加入以下代码
- <!--下拉导航条开始 QQ1047894-->
- <style type="text/css">
- #city *{ margin:0;padding:0; z-index:1000000; top:0;left:0px; float:left;}
- #warpper{ position: relative; z-index:1000000; margin-top:20px;}
- #city { font:normal 12px Verdana, Arial, Helvetica, sans-serif; text-align:center; z-index:1000000;}
- #city a{ cursor:pointer; color:#666}
- #city dl{ height:18px; line-height:18px; padding:0 10px;}
- #city dt,.normal{ float:left; padding:0 10px 0 0 ; border-right:0px solid #ccc; text-decoration:none; width:auto; cursor:pointer; color:#FF3300; font-weight:bold;}
- #city dt.over{ position:relative;padding:0 10px 0px 0px; z-index:1000001;color:#FF3300; font-weight:bold; height:20px; }
- <!--下来菜单可以根据实际情况修改宽度,有两处地方(默认为:width:180px)-->
- #city li{ float:left; list-style-type:none; margin:0px 5px; width:180px;}
- #city #c1 li a{ float:left; list-style-type:none; margin:0px 3px; 0 0 }
- #city dl dd{ position:absolute; width:180px; left:0;top:20px!important; border:1px solid #bbb; background:#fff; filter:progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=120, color=#cccccc); padding:3px 0;}
- .block{ display:block;}
- .none{ display:none;}
- </style>
- <script language="javascript">
- function $(str){ return document.getElementById(str);}
- function $$(str){ return document.getElementsByTagName(str);}
- var timer;
- function changeMenu(thisObj,num){
- if(thisObj.className=="over") return false;
- hids(thisObj);
- thisObj.className="over";
- $("c"+(num+1)).className="block";
- $("c"+(num+1)).onmouseover=function(){clearTimeout(timer);}
- $("c"+(num+1)).onmouseout=function(){timer=setTimeout(function(){hids(thisObj);},500)}
- thisObj.onmouseout=function(){timer=setTimeout(function(){hids(thisObj);},3000)}
- }
- function hids(thisObj){
- clearTimeout(timer);
- var tabObj=thisObj.parentNode.getAttribute("id");
- var obj_dt=$(tabObj).getElementsByTagName("dt");
- for(var i=0;i<obj_dt.length;i++){
- obj_dt[i].className="normal";
- $("c"+(i+1)).className="none";
- }
- }
- </script>
- <div id="city">
- <dl id="warpper">
- <dt onMouseOver="changeMenu(this,0);">[去其他县市]</dt>
- <dd id="c1" class="none">
- <ul>
- <li><a href="http://bbs.zzccoo.com/forum-40-1.html">株洲市</a> <a href="http://bbs.zzccoo.com/forum-180-1.html">醴陵市</a> <a href="http://bbs.zzccoo.com/forum-180-1.html">攸县县</a> <a href="http://bbs.zzccoo.com/forum-180-1.html">茶陵县</a> <a href="http://bbs.zzccoo.com/forum-180-1.html">株洲县</a> <a href="http://bbs.zzccoo.com/forum-180-1.html">炎陵县</a> <a href="http://bbs.zzccoo.com/forum-180-1.html">天元区</a> <a href="http://bbs.zzccoo.com/forum-180-1.html">录口县</a> <a href="http://bbs.zzccoo.com/forum-180-1.html">荷塘区</a>
- </li>
- </ul>
- </dd>
- </dl>
- </div>
- <!--下拉导航条结束 QQ1047894-->
效果图见下
转载于:https://blog.51cto.com/edsoki/624779