diff options
Diffstat (limited to 'doc/global/template/scripts/extras.js')
-rw-r--r-- | doc/global/template/scripts/extras.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/global/template/scripts/extras.js b/doc/global/template/scripts/extras.js new file mode 100644 index 0000000000..cb1102d493 --- /dev/null +++ b/doc/global/template/scripts/extras.js @@ -0,0 +1,23 @@ +var vOffset = 65; + +$(function () { + $('a[href*=#]:not([href=#])').on('click', function () { + var target = $(this.hash); + target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); + if (target.length) { + setTimeout(function () { + $('html, body').animate({scrollTop: target.offset().top - vOffset}, 50);}, 50); + // return false; + } + }); +}); + +$(window).load(function () { + var h = window.location.hash; + var re = /[^a-z0-9_\#\-]/i + if (h.length > 1 && !re.test(h)) { + setTimeout(function () { + $(window).scrollTop($(h).offset().top - vOffset); + }, 0); + } +}); |