mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-09-13 04:18:55 +00:00
19 lines
532 B
JavaScript
19 lines
532 B
JavaScript
$(document).ready(function() {
|
|
// bind click event to all internal page anchors
|
|
$('a.heading-link,#toc a').on('click', function(e) {
|
|
// prevent default action and bubbling
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
// set target to anchor's "href" attribute
|
|
var target = $(this).attr('href');
|
|
var hashid = target.split('#')[1];
|
|
// scroll to each target
|
|
$(target).velocity('scroll', {
|
|
duration: 500,
|
|
offset: -80,
|
|
easing: 'ease-in-out'
|
|
});
|
|
location.hash = hashid;
|
|
});
|
|
});
|