自带标签生成相信大家都知道,也很简单。
织梦默认的生成标签是这样的:
{dede:channel type=’top’ row=’10′ currentstyle=”<li class=’hover’><a href=http://www.dede58.com/’~typelink~’ ~rel~><span>~typename~</span></a></li>”}
<li><a href=http://www.dede58.com/’[field:typeurl/]‘ [field:rel/]><span>[field:typename/]</span></a></li>
{/dede:channel}
这个并不带有二级菜单,这里有一串代码,简单生成并带有下拉效果的二级菜单代码如下:
CSS代码:
.zb { list-style:none; text-align:left; position:absolute; z-index:99999; margin:0px; padding:0px !important; top:37px; left:0px; background:#009900; width:130px; display:none }
.zb li{ text-align:left ; line-height:30px !important; height:30px; width:130px; }
.r{ margin-left:10px; font-weight:normal}
.nav_cc li{ float:left;line-height:37px; font-weight:bold; color:#fff; font-family:黑体;}
.nav_cc ul{ padding-left:20px}
.nav_cc li a:link,.nav_cc li a:visited{ font-size:14px; color:#fff; margin:auto 15px}
.nav_cc li a:hover{ color:#f00}
.hover{color:#f00}
带有织梦标签的html:
<SCRIPT src=http://www.dede58.com/".min.js"></SCRIPT> //引入要用的js
<div class="nav_cc" style="overflow:inherit">
<ul id="shanmao">
<li><a href='{dede:global.cfg_cmsurl/}/'><span>主页</span></a> |</li>
{dede:channelartlist row=8}
<li style="position:relative;"><a href=http://www.dede58.com/"{dede:field name='typeurl'/}">{dede:field name='typename'/}</a> |
<ul class="zb">
{dede:sql sql='Select * from dede_arctype where reid=~id~ ORDER BY id limit 0,17'}
<li><a href='/plus/list.php?tid=[field:id/]' style="font-weight:normal">[field:typename/]</a></li>
{/dede:sql}
</ul></li>
{/dede:channelartlist}
<li><a href=http://www.dede58.com/"{dede:global.cfg_cmsurl/}/plus/guestbook.php">技术问答</a> |</li>
</ul>
</div>
最后是下拉菜单执行代码:
<script>
$(document).ready(function(){
$("#shanmao li").hover(function(){
$(this).children(".zb").slideDown(1000);
},function(){
$(this).children(".zb").slideUp(0);
});
});
</script>