织梦产品页折叠菜单,进入定位默认展开

2023/06/07 08:51    5G收录网    已浏览133次

织梦做产品栏目的时候,会有一级栏目和二级栏目,一般都喜欢用折叠的效果!!但是点击进入的话,默认会关闭!怎么才能让它默认打开呢!织梦58提供了这方面的标签和js! 注意!这个只是一个实例,没有折叠效果的js效果!js自行网上查找!!

01 <script>
02    $(document).ready(function () {
03         openoff('#part2_{dede:field.id/}');
04         openoff('#part2_{dede:field.reid/}');
05     })
06    function openoff(obj){
07        $(obj).next("dd").css("display","block");
08        $(obj).addClass("launched");
09    }
10    </script>
11  
12 <div class="menu" id="sidebar" data-csnow="2" data-class3="0" data-jsok="2"> {dede:channelartlist typeid=27}
13   <dl class="list-none navnow">
14     <dt id='part2_{dede:field name="id"/}' ><a href='{dede:field name="typeurl"/}'  title='{dede:field name="typename"/}' ><span>{dede:field name="typename"/}</span></a></dt>
15     <dd class="sub" style="display:none;"> {dede:channel type='son' noself='yes'}
16       <h4 id='part3_[field:id/]'><a href="[field:typedir function="str_replace('{cmspath}','',@me)"/]"  title='[field:typename /]' class='nav'><span>[field:typename /]</span></a></h4>
17       {/dede:channel}  </dd>
18   </dl>
19   {/dede:channelartlist}
20   <div class="clear"></div>
21 </div>
22   <Style type="text/css">
23     .launched{background-image:url(/skin/images/nav_hover.jpg);color: #d5b687;}
24     .list-none{ list-style:none; padding:0px; margin:0px;}
25     .menu dl{ margin-top:5px; }
26     .menu dt{cursor: pointer;margin-top: 10px;font-weight: bold;font-size: 16px;font-family: "微软雅黑";color: #0d2180;line-height: 53px;padding-left: 48px;
27 background: url(/skin/images/nav.jpg) no-repeat;}
28     .menu h4 a{ display: block;width: 200px;height: 28px;font-family: "微软雅黑";text-align: center;font-size: 14px;line-height: 28px;color: #333; }
29     .menu h4 span{ display: block;width: 200px;height: 28px; font-weight:100;font-family: "微软雅黑";text-align: center;font-size: 14px;line-height: 28px;color: #333; }
30     .menu h4 a:hover{color: #fff;background-color: #d5b687;}
31 </Style>