Skip to content

Commit

Permalink
Correct height and pass offset to onload function.
Browse files Browse the repository at this point in the history
  • Loading branch information
danimalweb committed May 20, 2019
1 parent 8a21a43 commit 496ed88
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hashy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

if (this.offset_elem.length) {
this.offset_elem.each(function () {
offset_height += (jQuery(this).height() - extra_offset);
offset_height += (jQuery(this).outerHeight() - extra_offset);
});
}

Expand Down Expand Up @@ -97,11 +97,12 @@

// Scroll to hash on page load. The browser does this by
// default but this will compensate for sticky headers

if (window.location.hash) {
jQuery(window).on('load', function () {
window.setTimeout(function() {
this.scrollToHash(window.location.hash, true);
}.bind(this), 200);
this.scrollToHash(window.location.hash, true, false, extra_offset);
}.bind(this), 0);
}.bind(this));
}
}
Expand Down

0 comments on commit 496ed88

Please sign in to comment.