Skip to content

Commit

Permalink
just use getElementById
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 3, 2015
1 parent cd547e8 commit 57117e4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Mojolicious/resources/templates/mojo/menubar.html.ep
Expand Up @@ -128,12 +128,11 @@
$('.mojoscroll').click(function (e) {
e.preventDefault();
e.stopPropagation();
var anchor = this.href.split('#')[1].replace(/(:|\.|\[|\]|,)/g, "\\$1");
var hash = '#' + anchor;
var target = $(hash);
var anchor = this.href.split('#')[1];
var target = $(document.getElementById(anchor));
var old = target.attr('id');
target.attr('id', '');
location.hash = hash;
location.hash = '#' + anchor.replace(/(:|\.|\[|\]|,)/g, "\\$1");
target.attr('id', old);
fixOffset();
});
Expand Down

0 comments on commit 57117e4

Please sign in to comment.