Hide Sticky Header when the Footer Appears - Code Snippet

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

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

  • @christianlecuyer6380
    @christianlecuyer6380 3 месяца назад +1

    Awesome tip! :)

  • @QuaverloveStudio
    @QuaverloveStudio 3 месяца назад +1

    Boom!

  • @dragon3602010
    @dragon3602010 3 месяца назад +2

    Great, thanks and can you show us how to hide the header when we scroll down and show it when we scroll up to make more space on mobile more particular thanks 👍🏼

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

      Yup I’ve got videos on show and hide based on scroll

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

    This is literally what I was trying to accomplish in my website last week. Where did I sign authorizing you to read my mind?

    • @keysncoffee7733
      @keysncoffee7733 3 месяца назад +1

      I swear this guy’s got cookies on our minds once we watched a video of his 😂

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

      :) :)

  • @dansk9963
    @dansk9963 3 месяца назад +2

    Thanks mate. Any way to make the disappearance and reappearance a bit more smooth? For example slide up/down?

    • @educationforever314
      @educationforever314 Месяц назад

      Smooth Header Transition

      .Hex {
      transition: opacity 0.5s, visibility 0.5s;
      opacity: 1;
      visibility: visible;
      }
      .Hex.hidden {
      opacity: 0;
      visibility: hidden;
      }

      Header Content

      Footer Content

      document.addEventListener('DOMContentLoaded', function() {
      // Get the header and footer elements
      const header = document.querySelector('.Hex');
      const footer = document.querySelector('.Fex');
      // Create an intersection observer
      const observer = new IntersectionObserver((entries) => {
      entries.forEach(entry => {
      if (entry.isIntersecting) {
      // Footer is in view, hide the header smoothly
      header.classList.add('hidden');
      } else {
      // Footer is not in view, show the header smoothly
      header.classList.remove('hidden');
      }
      });
      }, { threshold: 0 });
      // Start observing the footer
      observer.observe(footer);
      });

    • @educationforever314
      @educationforever314 Месяц назад

      I hope this will be helpful

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

    Please video on pricing table with Plus, Minus button and price change according to quantity for monthly and yearly with some discount in yearly tab.

  • @HoaLe-uq1pl
    @HoaLe-uq1pl 3 месяца назад

    Your video is really fascinating.
    But how about when I have multiple sections in the header? I added CSS Classes to all sections in header but its layout turn to be chaos.

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

      Difficult to be sure without working on your site.

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

    Footer: repeats header
    Don’t Repeat Yourself (DRY) principle: Am I a joke to you?

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

      What what what what what what what what what what what what what what what what what???????!?