jquery二级目录选中当前页的css样式

下面小编就为大家带来一篇jquery二级目录选中当前页的css样式。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

如下所示:

<div> <span><a href="https://www.jb51.net/M/Page_32.html" title="内科" >内科</a></span> <span><a href="https://www.jb51.net/M/Page_35.html" title="外科" >外科</a></span> <span><a href="https://www.jb51.net/M/Page_37.html" title="妇产科" >妇产科</a></span> <span><a href="https://www.jb51.net/M/Page_38.html" title="儿科" >儿科</a></span> <span><a href="https://www.jb51.net/M/Page_39.html" title="五官科" >五官科</a></span> <span><a href="https://www.jb51.net/M/Page_40.html" title="中医科" >中医科</a></span> <span><a href="https://www.jb51.net/M/Page_41.html" title="急诊科" >急诊科</a></span> <span><a href="https://www.jb51.net/M/Page_42.html" title="口腔科" >口腔科</a></span> <span><a href="https://www.jb51.net/M/Page_43.html" title="疼痛康复科" >疼痛康复科</a></span> <span><a href="https://www.jb51.net/M/Page_44.html" title="病理科" >病理科</a></span> <span><a href="https://www.jb51.net/M/Page_46.html" title="医技科室" >医技科室</a></span> <script> var url = window.location.href; $(".navlist span a").each(function () { if (url.indexOf($(this).attr("href")) > 0) { $(this).addClass("curent") } }) </script> </div>

js中判断当前页面URL是否包含二级栏目中的url

jquery二级目录选中当前页的css样式

jquery二级目录选中当前页的css样式

以上这篇jquery二级目录选中当前页的css样式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjfpsf.html