From: soufiane Date: Wed, 10 Sep 2025 16:38:08 +0000 (+0200) Subject: wait #7657 @0:30 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=9c2d06dae837019958fbd5d6a6af67458706982f;p=lyveas.git wait #7657 @0:30 --- diff --git a/web/app/themes/lyveas/functions.php b/web/app/themes/lyveas/functions.php index 7528dab..20330a3 100644 --- a/web/app/themes/lyveas/functions.php +++ b/web/app/themes/lyveas/functions.php @@ -83,6 +83,12 @@ function menu_css() { array(), '1.0' ); + wp_enqueue_script( + 'menu-js', + get_stylesheet_directory_uri() . '/resources/scripts/menu.js', + array(), + '1.0', + ); } add_action('wp_enqueue_scripts', 'menu_css'); diff --git a/web/app/themes/lyveas/resources/scripts/menu.js b/web/app/themes/lyveas/resources/scripts/menu.js new file mode 100644 index 0000000..85ee2bc --- /dev/null +++ b/web/app/themes/lyveas/resources/scripts/menu.js @@ -0,0 +1,11 @@ +const header = document.getElementsByClassName('site-header') +let lastKnownScrollPosition = 0 + +document.addEventListener('scroll', function (e) { + lastKnownScrollPosition = window.scrollY; + if (lastKnownScrollPosition > 100) { + header[0].classList.add('scrolling') + }else { + header[0].classList.remove('scrolling') + } +})