mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-14 02:15:09 +00:00
✨ Fix JS hash scrolling
This commit is contained in:
1 parent
5768d1c62b
commit
4130199888
2 files changed
+5
-2
No files matched your search
@@ -2,6 +2,10 @@
|
||||
{{ partial "navbar.html" . }}
|
||||
<div class="container">
|
||||
|
||||
<!-- Flag for jQuery -->
|
||||
<span id="homepage" style="display: none"></span>
|
||||
|
||||
|
||||
<!-- Biography Section -->
|
||||
{{ range $index, $page := where .Site.Pages "Section" "=" "home" }}
|
||||
{{ if eq .Title "about" }}
|
||||
|
||||
@@ -12,9 +12,8 @@
|
||||
$("#navbar-main li.nav-item a").on('click', function(event){
|
||||
|
||||
var hash = this.hash;
|
||||
var url = $(this).attr('href');
|
||||
|
||||
if( hash && $(hash).length && (url.split('#')[0] == window.location.pathname)) {
|
||||
if( hash && $(hash).length && ($("#homepage").length > 0)) {
|
||||
// Prevent default click behavior
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
Reference in new issue
Block a user