开发者

#view_comments from URL into jQuery

开发者 https://www.devze.com 2022-12-15 20:11 出处:网络
When I put www.test.com#view_comments in the URL I want to so show a div not by clicking anything, just by entering it into the URL bar.

When I put www.test.com#view_comments in the URL I want to so show a div not by clicking anything, just by entering it into the URL bar.

Can anyone help开发者_开发百科?


This will only work when the page first loads:

$(document).ready(function() {
  if(window.location.hash == '#view_comments') {
    $('.comments').show();
  }
});
0

精彩评论

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