Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- navHeight = $('#main_navigation').height();
- //ナビ部分の高さ計測用
- $(window).on('load', function() {
- var url = $(location).attr('href');
- setTimeout(function(){
- if(url.indexOf("?id=") != -1){
- var id = url.split("?id=");
- var $target = $('#' + id[id.length - 1]);
- if($target.length){
- var pos = $target.offset().top;
- var target_top = pos - navHeight;//ここでナビの高さを引く
- $("html, body").animate({scrollTop:target_top}, 1500);
- }
- }
- },100);
- });
- </script>
Add Comment
Please, Sign In to add comment