Skip to content

Commit

Permalink
Fix smooth scroll URL (hugo-toha#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
hossainemruz committed Aug 20, 2020
1 parent 61a9d7a commit 18a19d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions static/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var isMobile = false, isTablet = false, isLaptop = false;
// ================= Smooth Scroll ===================
function addSmoothScroll() {
// Add smooth scrolling to all links
$("a").on('click', function (event) {
$('a[href*="#"]').on('click', function (event) {

// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
Expand All @@ -47,9 +47,9 @@ var isMobile = false, isTablet = false, isLaptop = false;
}, 800, function () {

// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash - offset;
window.location.hash = hash
});
} // End if
}
});
}
addSmoothScroll();
Expand Down

0 comments on commit 18a19d0

Please sign in to comment.