Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Sticky navbar check if navbar element exists
givanz09bc23e321e3
diff --git a/public/js/app/theme.js b/public/js/app/theme.jsindex af7411c..9b6ca47 100644--- a/public/js/app/theme.js+++ b/public/js/app/theme.js@@ -12,7 +12,7 @@ window.onscroll = function() {navbarSticky()};// Get the navbarvar navbar = document.querySelector((typeof navbarSelector !== 'undefined') ? navbarSelector : ".navbar");// Get the offset position of the navbar-var sticky = navbar.offsetTop ? navbar.offsetTop : navbar.offsetHeight;+var sticky = navbar ? (navbar.offsetTop ? navbar.offsetTop : navbar.offsetHeight) : 0;function toggleNavbarTheme () {if (navbar.classList.contains("navbar-dark")) {@@ -27,6 +27,7 @@ function toggleNavbarTheme () {// Add the sticky class to the navbar when you reach its scroll position. Remove "sticky" when you leave the scroll positionfunction navbarSticky(isSticky) {+ if (!navbar) return;if (isSticky == undefined) {isSticky = (window.pageYOffset >= sticky);}