2014-10-21 12:57:50 +00:00
|
|
|
var vOffset = 65;
|
|
|
|
|
|
|
|
$(function () {
|
2015-02-06 14:51:23 +00:00
|
|
|
$('a[href*=#]:not([href=#])').on('click', function (e) {
|
|
|
|
if (e.which == 2)
|
|
|
|
return true;
|
2015-04-07 09:20:37 +00:00
|
|
|
var target = $(this.hash.replace(/(\.)/g, "\\$1"));
|
2014-10-21 12:57:50 +00:00
|
|
|
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
|
|
|
|
if (target.length) {
|
|
|
|
setTimeout(function () {
|
|
|
|
$('html, body').animate({scrollTop: target.offset().top - vOffset}, 50);}, 50);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$(window).load(function () {
|
|
|
|
var h = window.location.hash;
|
2015-04-07 09:20:37 +00:00
|
|
|
var re = /[^a-z0-9_\.\#\-]/i
|
2014-10-21 12:57:50 +00:00
|
|
|
if (h.length > 1 && !re.test(h)) {
|
|
|
|
setTimeout(function () {
|
2015-04-07 09:20:37 +00:00
|
|
|
$(window).scrollTop($(h.replace(/(\.)/g, "\\$1")).offset().top - vOffset);
|
2014-10-21 12:57:50 +00:00
|
|
|
}, 0);
|
|
|
|
}
|
|
|
|
});
|