1 |
/* |
/* |
2 |
CrudeDoc Java Script |
CrudeDoc Java Script |
3 |
Copyright (c) 2015 Christian Schoenebeck. All rights reserved. |
Copyright (c) 2015 - 2017 Christian Schoenebeck. All rights reserved. |
4 |
http://www.crudebyte.com |
http://www.crudebyte.com |
5 |
*/ |
*/ |
6 |
|
|
14 |
$('html, body').animate({ |
$('html, body').animate({ |
15 |
scrollTop: $( "#" + $(e).attr("section") ).offset().top - 68 |
scrollTop: $( "#" + $(e).attr("section") ).offset().top - 68 |
16 |
}, 300); |
}, 300); |
17 |
|
var obj = $( "#" + $(e).attr("section") ); |
18 |
|
$(obj).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(120).fadeOut(100).fadeIn(120); |
19 |
|
} |
20 |
|
|
21 |
|
function crdScrollToHash(h) { |
22 |
|
if (typeof h === 'undefined') { |
23 |
|
h = location.hash; |
24 |
|
if (!h || h.length < 2) return; |
25 |
|
} |
26 |
|
$('html, body').animate({ |
27 |
|
scrollTop: $( h ).offset().top - 68 |
28 |
|
}, 300); |
29 |
|
$(h).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(100).fadeOut(100).fadeIn(120).fadeOut(100).fadeIn(120); |
30 |
} |
} |
31 |
|
|
32 |
function crdOnScroll() { |
function crdOnScroll() { |
82 |
$(window).resize(function() { |
$(window).resize(function() { |
83 |
crdOnWindowResize(); |
crdOnWindowResize(); |
84 |
}); |
}); |
85 |
|
if ("onhashchange" in window) { |
86 |
|
window.onhashchange = function() { |
87 |
|
crdScrollToHash(); |
88 |
|
}; |
89 |
|
} |
90 |
|
$("article a[href]").each(function() { |
91 |
|
var href = $(this).attr("href"); |
92 |
|
if (href && href.length > 1 && href.charAt(0) == '#') { |
93 |
|
$(this).click(function(e) { |
94 |
|
var anch = $(this).attr("href"); |
95 |
|
crdScrollToHash(anch); |
96 |
|
}); |
97 |
|
} |
98 |
|
}); |
99 |
}); |
}); |
100 |
|
|
101 |
$(document).ready(function() { |
$(document).ready(function() { |
102 |
crdOnWindowResize(); |
crdOnWindowResize(); |
103 |
|
crdScrollToHash(); |
104 |
}); |
}); |
105 |
|
|
106 |
var _crdScrollTimeout; |
var _crdScrollTimeout; |