https://bootstrapmade.com/demo/impact/
Laden Sie die Vorlage herunter < /li>
Öffnen Sie sie in einem Webbrowser < /li>
Scrollen Sie nach unten auf ein paar tausend Pixel < /li>
Refresh /REGELADE DIE SEITE DIE SEITE VERWENDUNG DIE BROWSERS -BR /BR /F5 -OBRLL+R. /> Die Seite sollte nach zuvor aktualisiert/neu laden und in die gleiche y -Position scrollen. class = "Lang-JS PrettyPrint-Override">
Code: Select all
/**
* Template Name: Impact - v1.1.0
* Template URL: https://bootstrapmade.com/impact-bootstrap-business-website-template/
* Author: BootstrapMade.com
* License: https://bootstrapmade.com/license/
*/
document.addEventListener('DOMContentLoaded', () => {
"use strict";
/**
* Sticky Header on Scroll
*/
const selectHeader = document.querySelector('#header');
if (selectHeader) {
let headerOffset = selectHeader.offsetTop;
let nextElement = selectHeader.nextElementSibling;
const headerFixed = () => {
if ((headerOffset - window.scrollY) {
if (!navbarlink.hash)
return;
let section = document.querySelector(navbarlink.hash);
if (!section)
return;
let position = window.scrollY + 200;
if (position >= section.offsetTop && position {
el.addEventListener('click', function(event) {
event.preventDefault();
mobileNavToogle();
})
});
function mobileNavToogle() {
document.querySelector('body').classList.toggle('mobile-nav-active');
mobileNavShow.classList.toggle('d-none');
mobileNavHide.classList.toggle('d-none');
}
/**
* Hide mobile nav on same-page/hash links
*/
document.querySelectorAll('#navbar a').forEach(navbarlink => {
if (!navbarlink.hash)
return;
let section = document.querySelector(navbarlink.hash);
if (!section)
return;
navbarlink.addEventListener('click', () => {
if (document.querySelector('.mobile-nav-active')) {
mobileNavToogle();
}
});
});
/**
* Toggle mobile nav dropdowns
*/
const navDropdowns = document.querySelectorAll('.navbar .dropdown > a');
navDropdowns.forEach(el => {
el.addEventListener('click', function(event) {
if (document.querySelector('.mobile-nav-active')) {
event.preventDefault();
this.classList.toggle('active');
this.nextElementSibling.classList.toggle('dropdown-active');
let dropDownIndicator = this.querySelector('.dropdown-indicator');
dropDownIndicator.classList.toggle('bi-chevron-up');
dropDownIndicator.classList.toggle('bi-chevron-down');
}
})
});
/**
* Scroll top button
*/
const scrollTop = document.querySelector('.scroll-top');
if (scrollTop) {
const toggleScrollTop = function() {
window.scrollY > 100 ? scrollTop.classList.add('active') : scrollTop.classList.remove('active');
}
window.addEventListener('load', toggleScrollTop);
document.addEventListener('scroll', toggleScrollTop);
scrollTop.addEventListener('click', window.scrollTo({
top: 0,
behavior: 'smooth'
}));
}
});