From 97f5aa333f763c107f3d0a5f67ee8041946f6092 Mon Sep 17 00:00:00 2001 From: kolarix999 <94450116+kolarix999@users.noreply.github.com> Date: Fri, 17 Mar 2023 13:13:37 +0100 Subject: [PATCH] added header active class on scroll --- wp-content/themes/kolarix-biztime/js/theme.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wp-content/themes/kolarix-biztime/js/theme.js b/wp-content/themes/kolarix-biztime/js/theme.js index 5d70373..284a302 100644 --- a/wp-content/themes/kolarix-biztime/js/theme.js +++ b/wp-content/themes/kolarix-biztime/js/theme.js @@ -1,6 +1,19 @@ (function( $ ) { 'use strict'; + // Active header on scroll (970 Design - task 3) + const header = $('.header'); + + $(window).scroll(function() { + let scroll = window.pageYOffset; + + if (scroll > 100) { + header.addClass('active'); + } else { + header.removeClass('active'); + } + }); + // Mobile navigation toggle $(document).ready(function($) { let toggleMobileNav = function() {