Home  >  Article  >  php教程  >  tp内的导航高亮实现不需要eq标签

tp内的导航高亮实现不需要eq标签

WBOY
WBOYOriginal
2016-06-07 11:45:35976browse

tp内的导航高亮实现不需要eq标签
假设代码是    <volist><br>        <a>a.text</a><br>     </volist>向我们实现这种导航的高亮 html通常是写eq去判断,加个类
那样导致代码很长不易读,其实可以用jQuery实现<script><br /> $(function(){<br /> var current_url = '!-SELF-!';<br /> $('.nav[href="'+current_url+'"]').addClass('user_current');<br /> })<br /> </script>如果是子页面想高亮通过接受参数的方式 /code/edit/id/61.html 可以改为 cate={$_GET.cate}

下面的href= 改为*=就可以用href包含参数的方式判断高亮了

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:支持中文的basenameNext article:备份数据库