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

Line 75: Line 75:
 
         }
 
         }
 
     });
 
     });
    $("a[href^=#]").on("click", function() {
+
        var hash = this.href.substring(this.href.indexOf("#"));
        var $target = $(this.href);
+
        if (hash.indexOf("#") == 0) {
        $("html, body").animate({scrollTop: $target.offset().top - $(".sub-header").height()}, "slow");
+
            var $target = $(hash);
    });
+
            $("html, body").animate({scrollTop: $target.offset().top - $(".sub-header").height()}, "slow");
 +
        }
 
});
 
});
 
</script>
 
</script>

Revision as of 00:56, 19 September 2015