如何获取判断URL后面锚点
所属栏目: 网站开发 | 更新时间:2016-10-23 | 阅读:5828 次
获取URL后面锚点ID的方法依然很简单,一行代码搞定。
var thisId = window.location.hash;
如何运用获取到的ID:
例如:对URL后面锚点的ID添加样式(.uw3c):
$(function(){
var thisId = window.location.hash;
if(thisId != "" && thisId != undefined){
$(thisId).addClass("uw3c");
}
})

陕ICP备13005001号-1
陕公网安备 61102302611024号
工商监管