Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • 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 524 Views
  • 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 Offline
    S Offline
    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 Offline
      RichardR Offline
      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 Offline
        albrechtA Offline
        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 Offline
          arminunruhA Offline
          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 Offline
            L Offline
            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 Offline
              arminunruhA Offline
              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
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              I also code custom websites or custom Lay features.
              šŸ’æ Email me here: šŸ’æ
              info@laytheme.com

              Before you post:
              1. When using a WordPress Cache plugin, disable it or clear your cache.
              2. Update Lay Theme and all Lay Theme Addons
              3. Disable all Plugins
              4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

              This often solves issues you might run into

              When you post:
              1. Post a link to where the problem is
              2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
              3. If the problem is difficult to explain, post screenshots / link to a video to explain it
              Online Users
              A
              alasdair17
              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