做织梦网站导航栏时,我们一般需要设置当前栏目高亮显示,这个使用currentstyle就能直接实现,但是如果在首页时怎么让首页模块高亮呢?

织梦当前栏目高亮:

<style>.hover{background:#F00;}</style>
{dede:channel currentstyle="<li class='hover'><a href='~typelink~'>~typename~</a></li>"}
  <li><a href='[field:typeurl/]'>[field:typename/]</a></li>
{/dede:channel}

织梦首页高亮方法:

<style>.hover{background:#F00;}</style>
<a {dede:field name=typeid runphp="yes"}(@me=="")? @me=" class='hover'":@me="";{/dede:field} href="/">网站首页</a>

原理就是使用if判断当前页面是否有typeid,然后增加样式;如果在栏目页或文章页都会有typeid,在首页就没有。

相关文章:

  • 2022-01-11
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2021-11-02
猜你喜欢
  • 2022-12-23
  • 2022-02-09
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2021-05-21
  • 2022-12-23
相关资源
相似解决方案