Show Hide the Header on Scroll - Free Code - Elementor Wordpress Tutorial

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

Комментарии • 70

  • @vincemahama
    @vincemahama 2 месяца назад +1

    Absolutely zero issues. What a fantastic tutorial. Thanks a million

  • @arijacko
    @arijacko 9 месяцев назад +2

    Thank you! I got confused with your previous version, but this one was great because you specified that we must change the effects offset ourselves in the CSS snippet to see the change

  • @Greg.Mika.
    @Greg.Mika. 4 месяца назад

    To deliver such level of content with such consistency is just uncanny! Keep on Imran 🤟

  • @derleuchtturmwarter5866
    @derleuchtturmwarter5866 11 месяцев назад +1

    You always have the best topics in elementor and web stuff!

  • @antoniogarcia9271
    @antoniogarcia9271 11 месяцев назад

    Thanks Imran. It works great. Added to the toolbox. Have a great rest of your day!!

  • @markbratton111
    @markbratton111 11 месяцев назад

    And the beauty of it, of course, is that the code always remains here. No worries in it being in your customizer where it may get lost in the shuffle.

  • @06Smoker
    @06Smoker Месяц назад

    Hello Imran,
    Thank you for your hard work and such great content.
    I have two little issues with this one :
    - The header when scrolling up is totally disappearing on Safari, really weird.
    - Not working on mobile, it's stay sticky unfortunately...
    Thank you for your help on this you're the boss!

  • @npc-br
    @npc-br 4 месяца назад +1

    That's my guy just right there!

  • @BenBaudart
    @BenBaudart 11 месяцев назад +3

    I can see that like me some people are having issues with the header width when resizing the window horizontally (smaller then wider). The header then stays in its smaller width.
    There are 2 fixes, for both you need to update the custom CSS rule you created for the header.
    Solution 1: As commented on the previous video by @06smoker, update to :
    .scrolling-header {
    transition: all .5s ease !important;
    width: 100% !important;
    }
    Solution 2: Mine, change the 'all' to 'top' in the transition as it's interfering with another transition property :
    .scrolling-header {
    transition: top .5s ease !important;
    }
    Hope it helps someone else …

    • @websquadron
      @websquadron  11 месяцев назад +1

      Many thanks

    • @trntzx00
      @trntzx00 9 месяцев назад

      Thanks!!!!!!!!

    • @keptLV
      @keptLV 8 месяцев назад

      Hey. The header seems to hide when you scroll back up to the very top of the website on a mobile. Is that supposed to happen?

    • @PerhapsFilms
      @PerhapsFilms 3 дня назад

      @@keptLV did you find a solution?

  • @JulienPop
    @JulienPop 11 месяцев назад +1

    Great tutorial thanks !

  • @akkouk
    @akkouk 8 месяцев назад +1

    Great and easy solution! Is there a way for this to be enabled only on mobiles? I mean on the desktop the header to stay sticky on scrolling down but on mobile to work like it works on your tutorial?

    • @websquadron
      @websquadron  8 месяцев назад +2

      You'd have to wrap the code to only work when the @media is

  • @visualmodo
    @visualmodo 11 месяцев назад

    Truly good work ==DD

  • @kelvinnga295
    @kelvinnga295 7 месяцев назад +1

    can we have different way. the sticky. after the page scroll up.100px than appear the sticky nav ? if the page go top disappear sticky nav ?

  • @holliswebb1800
    @holliswebb1800 11 месяцев назад

    that's slick!!

  • @chilipalmer1904
    @chilipalmer1904 10 месяцев назад

    Great work.
    This is line 17 of your code '; and those symbols after bracket appears under footer, for me worked just removing them but not sure if its good way. Let me know if it is ok.

  • @gordonblackler2377
    @gordonblackler2377 11 месяцев назад

    Thanks once again for a great tutorial! Could you also find a way of creating a sticky header without using Elementor Pro or the premium version of an add-on plugin. Searching the WP repository, it seems that every plugin with a header / footer builder only has the sticky top as a paid feature. In many cases, I don't need 90% of the widgets they offer - I just want a sticky top. Any suggestions?

    • @websquadron
      @websquadron  11 месяцев назад +1

      I'll have a think, but using EL Pro is a massive time saver on many 3rd party plugins. Let me have a think.

  • @philwatson8694
    @philwatson8694 4 месяца назад

    Hi Imran, I've gone through the tutorial and added the code to snippets and the css to the parent container of a header template. For some reason it's not working - the header doesn't work responsively any more, with white gaps either size. Any ideas for a fix for this? Thanks for making such great content, if I can get this to work it's just what I need.

  • @ektopicbeats9070
    @ektopicbeats9070 11 месяцев назад

    very nice. I don't know if you can help off the top of your head... You know the loop grid tutorial you did recently with the text path and image mask - the circular one, how do I stop the text path text from lazy loading, It's really bugging me. I've tried fiddling with the phastpress settings and turning off WP meteor - no joy. I am also using your Stop Lazy Load code snippet. Am I missing something? I feel like it's unusable the way it is at the moment. Cheers bud

    • @websquadron
      @websquadron  11 месяцев назад

      Can you share the URL with it loaded? It shouldn't have any delay. Do you still get the issue on a new page that contains nothing else except the loop grid.

    • @ektopicbeats9070
      @ektopicbeats9070 11 месяцев назад

      Hey Imran, hope you are well. Thanks ever so much for the reply, I understand you are a busy man. I've been using Pods for a dynamic title, so I just changed it to a normal title and it loads fine without delay, I've changed it back to Pods, and now sometimes it loads fine, and others it loads on page scroll. The problem must be with pods. loading on page scroll is better than it was. I really appreciate you taking the time to reply to my message.👍@@websquadron

  • @rogerio8710
    @rogerio8710 11 месяцев назад

    Obrigado pela aula. Agora, se eu quiser colocar um cabeçalho como esse só que na parte de baixo do site e com algum atraso na exibição tipo: depois de rolar a página 500px, seria do mesmo modo?

    • @multa7053
      @multa7053 11 месяцев назад

      Xin lỗi, tôi chỉ nói được tiếng Việt

    • @websquadron
      @websquadron  11 месяцев назад

      You’ll have to test it but I’ll check when I get a chance

  • @rafiqraina4475
    @rafiqraina4475 18 дней назад

    This works good for Pc but on ipad and mobile this has a bug. As when we go the top of the page fast the header vanishes

    • @PerhapsFilms
      @PerhapsFilms 3 дня назад

      hey man I'm having the same problem! did you find solution?

  • @Growdigitalmindset
    @Growdigitalmindset 11 месяцев назад

    hello Imram.I had a problem yesterday with paying for the course with my credit card. Today I try to do it again but it no longer takes the discount coupon.

    • @websquadron
      @websquadron  11 месяцев назад +1

      Can you wait for a few hours and I will open the coupon for another 24 hours.

  • @duckapucko6395
    @duckapucko6395 10 месяцев назад

    For some reason the offset effect doesn't work for me at all. The JS kicks in immidiately after scrolling 1px... I'm also using a "section" instead of a container for my header - does that matter? It feels like the code should work anyways... Please help me!!

    • @websquadron
      @websquadron  10 месяцев назад

      Shouldn’t matter.
      It’s a weird one as to why some have an issue with it

  • @pawegabski5422
    @pawegabski5422 11 месяцев назад

    What to do when I have before header one more header? When scroll to the up that the second header hide this first header.

    • @websquadron
      @websquadron  11 месяцев назад

      That would be tricky unless you add them all into one header

  • @dan_kay
    @dan_kay 11 месяцев назад

    In tablet mode, I can see the edge of the parent container when I scroll down. It doesn't disappear completely. In mobile mode, it stays sticky, no matter what.
    Any ideas?

    • @websquadron
      @websquadron  11 месяцев назад

      I’ll have to check but when I tested it was fine

  • @kylequinn5629
    @kylequinn5629 10 месяцев назад

    I am running into the issue where when I scroll back up, the header only comes back halfway. Do you know why this is happening?

    • @websquadron
      @websquadron  10 месяцев назад

      Difficult as I’m assuming it’s the build?

    • @kylequinn5629
      @kylequinn5629 10 месяцев назад

      ​@@websquadron It has to be something wrong with the build since I have tried to make the same hide + show header using other methods (I used the HTML widget, and tried using elementor custom code as well) and the same issue still happens.
      My site is only 1 page and I made my header as a template that I imported to it. Would this be a reason why this is happening?
      Do you have any other Idea of why this might be happening, or if there is someone I can reach out to about this? I have been looking for answers on how to solve this for a while now and feel like I have run out of options..

    • @kylequinn5629
      @kylequinn5629 9 месяцев назад

      Any Idea why this is happening? As I have seen comments on here where this happens to others as well.

  • @porkchopsanddoobies
    @porkchopsanddoobies 8 месяцев назад

    Any idea how to do this on mobile?

    • @websquadron
      @websquadron  8 месяцев назад

      Is it not working for you on the mobile?

    • @porkchopsanddoobies
      @porkchopsanddoobies 8 месяцев назад

      @@websquadron For some reason it is now but acting a bit buggy with the hide aspect. Its currently not hiding anymore. Im attempting to use two headers, one for larger screens, desktops, laptops etc and one for mobile. Would I be able to use the same process you provided or would I need to separate the two somehow with CSS Classes or something? I really appreciate your videos and thanks so much for your time and help.

  • @markbaquerizo6190
    @markbaquerizo6190 10 месяцев назад

    When you go to the bottom it creates a blank space on canvas template, can you update the code to delete that space, please. Check it out.

    • @websquadron
      @websquadron  10 месяцев назад

      I'll check as I don't recall that being there

    • @markbaquerizo6190
      @markbaquerizo6190 6 месяцев назад

      @@websquadron
      add_action('wp_footer', 'custom_hide_header_script');
      function custom_hide_header_script() {
      ?>
      (function() {
      var prevScrollpos = window.pageYOffset;
      var scrollingHeader = document.getElementById("scrolling-header");
      if (scrollingHeader) {
      window.onscroll = function() {
      var currentScrollPos = window.pageYOffset;
      if (prevScrollpos > currentScrollPos) {
      scrollingHeader.style.top = "0";
      } else {
      scrollingHeader.style.top = "-" + scrollingHeader.offsetHeight + "px";
      }
      prevScrollpos = currentScrollPos;
      }
      }
      })();

  • @SmartServe_official
    @SmartServe_official 11 месяцев назад

    The code is different and does work sadly. Can you please help?

    • @websquadron
      @websquadron  11 месяцев назад

      Use this as there was a problem with the online one. That has now been replaced:
      (function() {
      var prevScrollpos = window.pageYOffset;
      window.onscroll = function() {
      var currentScrollPos = window.pageYOffset;
      if (prevScrollpos > currentScrollPos) {
      document.getElementById("scrolling-header").style.top = "0";
      } else {
      document.getElementById("scrolling-header").style.top = "-100px";
      }
      prevScrollpos = currentScrollPos;
      }
      })();
      ';

  • @capitanchorizzo
    @capitanchorizzo 11 месяцев назад

    CSS does not go into Code Snippets free version …

    • @websquadron
      @websquadron  11 месяцев назад +1

      The JS goes there.

    • @capitanchorizzo
      @capitanchorizzo 11 месяцев назад

      Thanks, figured it out right after posting …@@websquadron

  • @MrJohnboom
    @MrJohnboom 11 месяцев назад +1

    Hi Imran, posted already a comment in your other video ruclips.net/video/WuWL_BNyhfU/видео.htmlsi=wYcjsuDVp4U5tzvJ since it is exactly the same code snippet that you previously used, is it still breaking the menu when you are changing screen display on developer tools or with tablet from portrait to landscape mode?
    "Have you tried playing with the developer tools from chrome and manually adjust the width from smaller screen to bigger screen and vice versa with this snippet? Very strange behavior that shrink the header.. Same problem occur while using a tablet and turning it few times to pass from a portrait to a landscape mode. The menu will break and need to refresh.."

    • @adrian.fernandes
      @adrian.fernandes 11 месяцев назад

      Agree. Have this same issue.

    • @websquadron
      @websquadron  11 месяцев назад

      Is your menu changing in height when you change orientation?

    • @MrJohnboom
      @MrJohnboom 11 месяцев назад

      @@websquadron Sent you an email with a different snippet that fix the bug :)

    • @adrian.fernandes
      @adrian.fernandes 11 месяцев назад

      @@websquadron yes the height changes on mobile and tablet.

    • @websquadron
      @websquadron  11 месяцев назад

      @@adrian.fernandes use this JS instead:
      add_action('wp_footer', 'custom_hide_header_script');
      function custom_hide_header_script() {
      ?>
      jQuery(document).ready(function($) {
      var prevScrollpos = window.pageYOffset;
      var header = document.getElementById("header-2");
      window.onscroll = function() {
      var currentScrollPos = window.pageYOffset;
      if (prevScrollpos > currentScrollPos) {
      header.style.top = "0";
      } else {
      header.style.top = "-" + header.offsetHeight + "px";
      }
      prevScrollpos = currentScrollPos;
      };
      });

  • @lushprod
    @lushprod 3 месяца назад

    doesn't work for me

    • @websquadron
      @websquadron  3 месяца назад

      How so, as it works for me? Have you inspected for console issues?

    • @lushprod
      @lushprod 3 месяца назад

      @@websquadron the nav goes down and i put in the correct css etc, nav doesn;t go up. no worries found an other one

    • @06Smoker
      @06Smoker Месяц назад

      @@lushprod Hello, which one is the other one you find please?