1 $(window).on('load',function () {
3 var hash, navHeight, id;
5 hash = window.location.hash;
6 navHeight = $('.nav-wrapper').height();
8 if (hash.indexOf('.') !== -1) {
10 hash = document.getElementById(hash.replace('#', ''));
14 $('html, body').animate({ scrollTop: $(hash).offset().top - navHeight - 10 }, 350);
16 /* Anchor Process End */
18 /* Toc click process */
19 $('.toc ul li > a').click(function () {
20 if ($(this).attr('href')[0] === '#') {
21 id = String($(this).attr('href'));
22 if (id.indexOf('.') !== -1) {
23 id = document.getElementById(id.replace('#', ''));
25 $('html,body').animate({
26 scrollTop: ($(id).offset().top - navHeight - 10)
31 /* Toc click process End */
33 /* Title number click process */
34 $('.mw-headline-number').click(function () {
35 $('html,body').animate({
36 scrollTop: ($('#toctitle').offset().top - navHeight - 10)
40 /* Title number click process End */
42 /* Toc Click Process */
43 $('.mw-cite-backlink > a').click(function () {
44 if ($(this).attr('href')[0] === '#') {
45 id = String($(this).attr('href'));
46 if (id.indexOf('.') !== -1) {
47 id = document.getElementById(id.replace('#', ''));
49 $('html,body').animate({
50 scrollTop: ($(id).offset().top - navHeight - 10)
56 $('.mw-cite-backlink > * > a').click(function () {
57 if ($(this).attr('href')[0] === '#') {
58 id = String($(this).attr('href'));
59 if (id.indexOf('.') !== -1) {
60 id = document.getElementById(id.replace('#', ''));
62 $('html,body').animate({
63 scrollTop: ($(id).offset().top - navHeight - 10)
69 $('.reference > a').click(function () {
70 if ($(this).attr('href')[0] === '#') {
71 id = String($(this).attr('href'));
72 if (id.indexOf('.') !== -1) {
73 id = document.getElementById(id.replace('#', ''));
75 $('html,body').animate({
76 scrollTop: ($(id).offset().top - navHeight - 10)
81 /* Toc Click Process End */
83 /* Preference Tab Click Process */
84 $('#preftoc li > a').click(function () {
85 if ($(this).attr('href')[0] === '#') {
86 id = String($(this).attr('href'));
87 if (id.indexOf('.') !== -1) {
88 id = document.getElementById(id.replace('#', ''));
90 $('html,body').animate({
95 /* Preference Tab Click Process End */