如何通过js实现html导航栏自动定位高亮代码
如何通过js实现html导航栏自动定位高亮呢,之前一直都是使用php直接高亮,不经代码多,还麻烦,所以用js给大家分享一下。非常的方便实用哦!
$(document).ready(function() {
var s = document.location
$("#divNavBar a").each(function() {
if (this.href == s.toString().split("#")[0]) {
$(this).addClass("hover")
return false
}
})
})...知识 2025-05-14 0 1396


