网站首页 » dede » 织梦万能栏目高亮代码(JS方式)

织梦万能栏目高亮代码(JS方式)

August 26, 2018 dede

导航设置
1.首页 加

id='index'

2.其他顶级栏目加

id="id{dede:field name='typeid'/}"

3.页面底部加

  <script>
  var typeid={dede:field.id/};
      {dede:channelartlist type='son' noself='true'   typeid ='1'}
        if({dede:channel type='son' noself='true'}typeid==[field:id/]||{/dede:channel}typeid=={dede:field.id/}){
            var id={dede:field.id/};
        }
    {/dede:channelartlist}
  if(id==''){
    document.getElementById("index").className="uk-parent uk-active";
  }else{
    document.getElementById("id"+id).className="uk-parent uk-active";
  }
 </script>

4.前端现实效果

  <script>
  var typeid=32;
      if(typeid==18||typeid==3||typeid==4||typeid==5||typeid==6||typeid==2){
            var id=2;
        }if(typeid==8||typeid==19||typeid==20||typeid==21||typeid==22||typeid==7){
            var id=7;
        }if(typeid==10||typeid==11||typeid==9){
            var id=9;
        }if(typeid==13||typeid==14||typeid==15||typeid==12){
            var id=12;
        }if(typeid==16||typeid==31||typeid==32||typeid==17){
            var id=17;
        } 
  if(id==''){
    document.getElementById("index").className="uk-parent uk-active";
  }else{
    document.getElementById("id"+id).className="uk-parent uk-active";
  }
 </script>

end

Title - Artist
0:00