谁能帮我...我想根据我的网址活动链接基于URL
这里我的菜单上添加一个活动类的代码是
<div class="taglist">
<a class="automotive" title="Automotive Tag" href="#">Automotive</a>
<a class="banca" title="Banca Tag" href="#">Banca</a>
<a class="banking-pt" title="Banking Tag" href="#">Banking</a>
<a class="big-data" title="Big Data Tag" href="#">Big Data</a>
<a class="bigdata" title="BigData Tag" href="#">BigData</a>
<a class="cloud" title="Cloud Tag" href="#">Cloud</a>
</div>
可能URL's
http://www.whatever.com/?tag=automotive,big-data,cloud
http://www.whatever.com/?tag=automotive,big-data
http://www.whatever.com/tag/automotive
所以,我需要的是当网址是http://www.whatever.com/?tag=automotive,big-data我想添加一个类,如活动。
例子:
URL: http://www.whatever.com/?tag=automotive,big-data
HTML:
<div class="taglist">
<a class="automotive active" title="Automotive Tag" href="#">Automotive</a>
<a class="banca" title="Banca Tag" href="#">Banca</a>
<a class="banking-pt" title="Banking Tag" href="#">Banking</a>
<a class="big-data active" title="Big Data Tag" href="#">Big Data</a>
<a class="bigdata" title="BigData Tag" href="#">BigData</a>
<a class="cloud" title="Cloud Tag" href="#">Cloud</a>
</div>
[jQuery的主动类菜单项基于当前URL](可能重复http://stackoverflow.com/questions/10593591/jquery -active-class-to-menu-item-based-on-current-url) – Turnip 2014-12-05 12:09:04
是......是真的,但只适用于带有一个标签的网址(http://www.whatever.com/?tag=汽车)......如果你有多个标签(http://www.whatever.com/?tag=automotive,big-data),它不起作用 – 2014-12-05 12:14:55
@ LuisP.A。你看到我的代码了吗?它适用于你 – clement 2014-12-05 12:21:16