您可以使用
window.location获取当前URL,然后基于该URL进行切换:
$(function() { var loc = window.location.href; // returns the full URL if(/technology/.test(loc)) { $('#main').addClass('tech'); }});
technology),如果包含,则将一个类添加到该
#main元素。
欢迎分享,转载请注明来源:内存溢出
您可以使用
window.location获取当前URL,然后基于该URL进行切换:
$(function() { var loc = window.location.href; // returns the full URL if(/technology/.test(loc)) { $('#main').addClass('tech'); }});
technology),如果包含,则将一个类添加到该
#main元素。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)