开发者

Jquery: Show | Hide Div if Hash and Div ID match?

开发者 https://www.devze.com 2023-03-19 23:37 出处:网络
I\'m trying to create a jquery function that checks the URL hash link and match it to a Div ID which shows or hides the DIV on load. I searche开发者_Go百科d around but haven\'t found a solid fix.I\'m

I'm trying to create a jquery function that checks the URL hash link and match it to a Div ID which shows or hides the DIV on load. I searche开发者_Go百科d around but haven't found a solid fix.


I'm not sure I understood what you meant, but if you want to hide the current page's nav link for example...

$(document).ready(function() {
  url = document.location.href;
  hash = url.split('#');
  $('#'+hash[1]).hide();
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号