Skip to content

Commit

Permalink
Fix the scrollspy for external links
Browse files Browse the repository at this point in the history
Closes ApiGen#2
  • Loading branch information
stof committed Jan 29, 2015
1 parent bbdeeac commit 84ec40d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion resources/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
var offset = 50;

$('.navbar li a.scroll').click(function(event) {
var href = $(this).attr('href');

if (href.length === 0 || '#' !== href.charAt(0)) {
return;
}

event.preventDefault();
$($(this).attr('href'))[0].scrollIntoView();
$(href)[0].scrollIntoView();
scrollBy(0, -offset);
});

0 comments on commit 84ec40d

Please sign in to comment.