From 9c2d06dae837019958fbd5d6a6af67458706982f Mon Sep 17 00:00:00 2001 From: soufiane Date: Wed, 10 Sep 2025 18:38:08 +0200 Subject: [PATCH] wait #7657 @0:30 --- web/app/themes/lyveas/functions.php | 6 ++++++ web/app/themes/lyveas/resources/scripts/menu.js | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 web/app/themes/lyveas/resources/scripts/menu.js 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') + } +}) -- 2.39.5