Eyoucms手風琴三級菜單,掌握三級分類用法
2020-06-09
應用:適用于左右結構排版三級產品分類或文章分類。
1、效果圖

2、HTMl
<!-- 分類折疊手風琴菜單 開始 -->
<div class="subnavbox bg-white radius">
<h2 class="bg-blue text-white">{eyou:channelartlist typeid='$eyou.field.typeid|gettoptype=###,typeid'}{eyou:field name='typename' /}{/eyou:channelartlist}</h2>
<!--當前欄目下二級欄目調用-->
{eyou:channel type="first" currentstyle="active"}
{eyou:eq name='$eyou.field.grade' value='2'}
{eyou:type typeid='$eyou.field.typeid' id='field1'}
{eyou:eq name='$field1.parent_id' value='$field.id'}
{eyou:assign name='$field.currentstyle' value='current' /}
<!--current對應樣式中的display:block-->
{/eyou:eq}
{/eyou:type}
{/eyou:eq}
<div class="{$field.currentstyle}dd {$field.currentstyle}dt suboneNav">{$field.typename}</div>
<!--當前欄目下三級欄目調用-->
{eyou:notempty name="$field.children"}
<ul class="cur-bg {$field.currentstyle}">
{eyou:channel name="$field.children" id="field2"}
<li><a href="{$field2.typeurl}" class="{$field2.currentstyle}">{$field2.typename}{$field2.typeid}</a>
</li>
{/eyou:channel}
</ul>
{/eyou:notempty}
{/eyou:channel}
</div>
<!-- 分類折疊手風琴菜單 結束 -->3、CSS
.subnavbox h2 {line-height:60px;height:60px;position:relative;font-size:20px;padding:0 0 0 20px;}
.subnavbox .current {display:block;}
.subnavbox .cur-bg{background:#fff;padding:10px 0;}
.subnavbox ul {display:none;}
.subnavbox ul li a{display:block;line-height:36px;font-size:14px;color:#999;padding-left:20px;}
.subnavbox ul li a:hover {color:#FF6D33;}
.subnavbox ul li a.active {color:#FF6D33;}
.suboneNav{border-bottom:solid 1px #0BECF1;background:#0AD4D9 url(../images/ico_jia.png) no-repeat;background-position:95% 50%;cursor:pointer;font-size:16px;color:#fff;line-height:54px;padding-left:20px;}
.suboneNav:last-child{border-bottom:0;border-bottom-left-radius:4px;border-bottom-right-radius:4px}
.currentdt {background-image:url(../images/ico_jian.png);}4、JS
$(".suboneNav").click(function () {
$(this).toggleClass("currentdd").siblings(".suboneNav").removeClass("currentdd");
$(this).toggleClass("currentdt").siblings(".suboneNav").removeClass("currentdt");
$(this).next("ul").slideToggle(300).siblings("ul").slideUp(500);
})







