Use button-based homepage section scrolling
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 28s
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 28s
This commit is contained in:
@@ -15,15 +15,15 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="hero-actions">
|
<div class="hero-actions">
|
||||||
<a class="btn btn-default home-scroll" href="#" data-target="#overview-getting-started">
|
<button class="btn btn-default home-scroll" type="button" data-target="#overview-getting-started">
|
||||||
<i data-lucide="rocket"></i> <span data-tkey="gettingStarted">Getting Started</span>
|
<i data-lucide="rocket"></i> <span data-tkey="gettingStarted">Getting Started</span>
|
||||||
</a>
|
</button>
|
||||||
<a class="btn btn-primary home-scroll" href="#" data-target="#overview-pool-blocks">
|
<button class="btn btn-primary home-scroll" type="button" data-target="#overview-pool-blocks">
|
||||||
<i data-lucide="blocks"></i> <span data-tkey="poolBlocks">Pool Blocks</span>
|
<i data-lucide="blocks"></i> <span data-tkey="poolBlocks">Pool Blocks</span>
|
||||||
</a>
|
</button>
|
||||||
<a class="btn btn-primary home-scroll" href="#" data-target="#overview-faq">
|
<button class="btn btn-primary home-scroll" type="button" data-target="#overview-faq">
|
||||||
<i data-lucide="messages-square"></i> FAQ
|
<i data-lucide="messages-square"></i> FAQ
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -720,7 +720,11 @@ $('.home-scroll').click(function(e) {
|
|||||||
let target = $(this).data('target');
|
let target = $(this).data('target');
|
||||||
let el = document.querySelector(target);
|
let el = document.querySelector(target);
|
||||||
if (el) {
|
if (el) {
|
||||||
el.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
const nav = document.querySelector('.nav-side-menu');
|
||||||
|
const topBar = document.getElementById('top-bar');
|
||||||
|
const offset = (nav ? nav.offsetHeight : 0) + (topBar ? topBar.offsetHeight : 0) + 24;
|
||||||
|
const top = window.pageYOffset + el.getBoundingClientRect().top - offset;
|
||||||
|
window.scrollTo({ top: Math.max(0, top), behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
home_InitTemplate(lastStats)
|
home_InitTemplate(lastStats)
|
||||||
|
|||||||
Reference in New Issue
Block a user