无需程序代码支持,只要一段JS代码就行了。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/10362.html
首先,先加载JQ文件,文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/10362.html
然后,在页面调用以下JS代码即可:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/10362.html
1 | <script>$( function (){$( 'a[href="' +window.location.pathname+window.location.search '"]' ).addClass( "hover" );})</scrtip> <style>a.hover{color: #0071BE; font-weight:bold}</style> |
完事了哈!推荐给$('a 这个加一个你栏目外层的div的class如 $('.class a 这样能避免其他地方高亮哈!文章源自菜鸟学院-https://www.cainiaoxueyuan.com/cms/10362.html