Difference between revisions of "Template:BNU-CHINA/article"

 
(4 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
         if (hash.indexOf("#") == 0) {
 
         if (hash.indexOf("#") == 0) {
 
             var $target = $(hash);
 
             var $target = $(hash);
             $("html, body").animate({scrollTop: $target.offset().top - $(".sub-header").height()}, "slow");
+
             $("html, body").animate({scrollTop: $target.offset().top - $(".sub-header").height() - baseline + 2}, "slow");
 
         }
 
         }
 
     };
 
     };
  
    scrollToHash(window.location.hash);
 
  
 
     $(".sub-header").css({
 
     $(".sub-header").css({
Line 83: Line 82:
 
     });
 
     });
  
     $("a[href^=#]").on("click", function() {
+
     $("a[href]").on("click", function() {
 
         var hash = this.href.substring(this.href.indexOf("#"));
 
         var hash = this.href.substring(this.href.indexOf("#"));
 
         scrollToHash(hash);
 
         scrollToHash(hash);
 
     });
 
     });
  
 +
    scrollToHash(window.location.hash);
  
 
});
 
});

Latest revision as of 01:33, 19 September 2015