Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Hide mobile menu, when scrolling down

Hide mobile menu, when scrolling down

Scheduled Pinned Locked Moved General Discussion
6 Posts 5 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    S
    schmarcopolo
    wrote on last edited by
    #1

    Hey ,

    I want to know if its possible to hide the mobile menu bar when you scrolling down?

    I know where i can add the JS for that but i dont know the HTML class i need to address, to remove the menu bar when u scrolling down on your mobile device.

    Would be great if one of u could share some ideas or maybe had the same problem before.

    Thank you

    best regards

    Schmarcopolo

    1 Reply Last reply
    0
    • RichardR
      RichardR
      Richard
      Global Moderator
      wrote on last edited by
      #2

      Dear @schmarcopolo

      Could you please post a link to your website and i can take a better look :)

      Sincerely
      Richard

      1 Reply Last reply
      0
      • albrechtA
        albrechtA
        albrecht
        wrote on last edited by albrecht
        #3

        Hi Guys,

        @Richard @arminunruh

        same topic. Want to hide site titel and Navbar when scrolling on mobile (like it is on Desktop) using this script below:

        But can't address the right class(?). What I doing wrong?

        Link to website
        https://truestedt.albrechtgaebel.de/

        Thx

        <script>
        var prevScrollpos = window.pageYOffset;
        window.onscroll = function() {
        var currentScrollPos = window.pageYOffset;
          if (prevScrollpos > currentScrollPos) {
            document.getElementById("navbar").style.top = "0";
          } else {
            document.getElementById("navbar").style.top = "-50px";
          }
          prevScrollpos = currentScrollPos;
        }
        </script>```
        1 Reply Last reply
        0
        • arminunruhA
          arminunruhA
          arminunruh
          Global Moderator
          wrote on last edited by
          #4

          navbar doesnt have the id navbar but the class navbar

          you could just do jQuery('.navbar').css('transform', 'translateY(-100%)');

          L 1 Reply Last reply
          0
          • arminunruhA arminunruh

            navbar doesnt have the id navbar but the class navbar

            you could just do jQuery('.navbar').css('transform', 'translateY(-100%)');

            L
            L
            Ludwig
            wrote on last edited by
            #5

            @arminunruh
            where, how, what can i enter, that the mobile-menue hides ?

            1 Reply Last reply
            0
            • arminunruhA
              arminunruhA
              arminunruh
              Global Moderator
              wrote on last edited by
              #6

              @Ludwig said in Hide mobile menu, when scrolling down:

              where, how, what can i enter, that the mobile-menue hides ?

              hey theres no lay theme built in way for the mobile menu to hide on scroll

              i think @albrecht might have used this code to make it work not sure

              <script>
              var prevScrollpos = window.scrollY;
              window.onscroll = function() {
              var currentScrollPos = window.scrollY;
                if (prevScrollpos > currentScrollPos) {
                  document.querySelector(".navbar").style.top = "0";
                } else {
                  document.querySelector(".navbar").style.top = "-50px";
                }
                prevScrollpos = currentScrollPos;
              }
              </script>
              
              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              Online Users
              L
              lukas123
              Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
              laytheme.com
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Recent
              • Tags
              • Popular
              • Users
              • Search