AI Verified

Name

Elementor Scrolling Header

About

This allows the header to disappear when you scroll down and to reappear s soon as you scroll up.

Language

PHP

Rating

Voted: 3 by 3 user(s)

How to Setup Snippet

Add the JS after making the sticky header's CSS ID and CLASS = 'scrolling-header' Also add this CSS to the CSS: CSS Code for Transition: .scrolling-header { transition: all .5s ease!important; }

Codevault

WebSquadron

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

19/04/2024

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Elementor Scrolling Header

 
                    
1add_action('wp_footer', 'custom_hide_header_script');
2function custom_hide_header_script() {
3?>
4<script type="text/javascript">
5 (function() {
6 var prevScrollpos = window.pageYOffset;
7 window.onscroll = function() {
8 var currentScrollPos = window.pageYOffset;
9 if (prevScrollpos > currentScrollPos) {
10 document.getElementById("scrolling-header").style.top = "0";
11 } else {
12 document.getElementById("scrolling-header").style.top = "-100px";
13 }
14 prevScrollpos = currentScrollPos;
15 }
16 })();
17</script>
18<?php
19}
20?>

3

Comments

  • C

    8 months ago

    top
  • S

    8 months ago

    Corresponding video: https://www.youtube.com/watch?v=WuWL_BNyhfU

Related Snippets

Please see some snippets below related to this snippet..

Elementor

AI Verified

0

Add space for Elementor Menu Anchor link

Added: 1 month ago

Last Updated: 1 month ago

הקוד הנ"ל מוסיף מרווח של 30 פיקסלים כאשר גוללים לעוגן באמצעות תפריט Elementor

Elementor

AI Verified

0

Reorder Columns in mobile view

Added: 1 year ago

Last Updated: 1 year ago

By using This snippet you can see new option in mobile view to reorder the column the way you need.

Elementor

AI Verified

0

Remove Last Paragraph Margin in Elementor Text Editor

Added: 7 months ago

Last Updated: 7 months ago

This code snippet ensures a uniform styling change across your WordPress site by removing the margin-bottom from the last paragraph in Elementor text editor widgets, enhancing visual consistency.

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

Performance

AI Verified

32

Remove Unused Javascript

Added: 1 year ago

Last Updated: 3 days ago

Remove Unused Javascript - and improve your Page Speed Insight Score

WooCommerce

Pro Verified

10

Deactivate some WooCommerce Checkout Fields

Added: 1 year ago

Last Updated: 2 weeks ago

Deactivate some WooCommerce Checkout Fields from showing

Elementor

AI Verified

6

CSS Grid Aid

Added: 8 months ago

Last Updated: 1 month ago

This can be used for any WordPress Builder to aid working with CSS Grids.