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

Line 15: Line 15:
 
<script>
 
<script>
 
$(document).ready(function () {
 
$(document).ready(function () {
 +
    var scrollToHash = function(hash) {
 +
        if (hash.indexOf("#") == 0) {
 +
            var $target = $(hash);
 +
            $("html, body").animate({scrollTop: $target.offset().top - $(".sub-header").height()}, "slow");
 +
        }
 +
    }
 +
 
     scrollToHash(window.location.hash);
 
     scrollToHash(window.location.hash);
  
Line 80: Line 87:
 
     });
 
     });
  
    var scrollToHash = function(hash) {
+
 
        if (hash.indexOf("#") == 0) {
+
            var $target = $(hash);
+
            $("html, body").animate({scrollTop: $target.offset().top - $(".sub-header").height()}, "slow");
+
        }
+
    }
+
 
});
 
});
 
</script>
 
</script>

Revision as of 01:16, 19 September 2015