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. Transparent Navbar (header)

Transparent Navbar (header)

Scheduled Pinned Locked Moved General Discussion
15 Posts 6 Posters 983 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.
  • RichardR Offline
    RichardR Offline
    Richard
    Global Moderator
    wrote on last edited by
    #6

    Dear @antonioprado

    You need to look into adding "JQuery" so that based on where you are down the page, the Navbar will be either transparent or white

    https://stackoverflow.com/questions/23706003/changing-nav-bar-color-after-scrolling

    This will require some basic JS/ jQuery knowledge and you may need some help from a kind developer if it is too difficult for you,

    Remember when inserting jQuery Code that the common " $ " sign needs to be changed for " jQuery ".

    https://laytheme.com/documentation.html#custom-javascript

    Also have a look into if others on the forum have found similar solutions in the past:

    http://laythemeforum.com:4567/search?term=change on scroll&in=posts&matchWords=all&sortBy=relevance&sortDirection=desc&showAs=posts

    Im Sorry that right now i am unable to go further with you, but best of luck, there is a lot of content on the internet about this question so dont give up! :)

    Best Wishes
    Richard

    A 1 Reply Last reply
    0
    • RichardR Richard

      Dear @antonioprado

      You need to look into adding "JQuery" so that based on where you are down the page, the Navbar will be either transparent or white

      https://stackoverflow.com/questions/23706003/changing-nav-bar-color-after-scrolling

      This will require some basic JS/ jQuery knowledge and you may need some help from a kind developer if it is too difficult for you,

      Remember when inserting jQuery Code that the common " $ " sign needs to be changed for " jQuery ".

      https://laytheme.com/documentation.html#custom-javascript

      Also have a look into if others on the forum have found similar solutions in the past:

      http://laythemeforum.com:4567/search?term=change on scroll&in=posts&matchWords=all&sortBy=relevance&sortDirection=desc&showAs=posts

      Im Sorry that right now i am unable to go further with you, but best of luck, there is a lot of content on the internet about this question so dont give up! :)

      Best Wishes
      Richard

      A Offline
      A Offline
      antonioprado
      wrote on last edited by antonioprado
      #7

      @Richard-Keith Hello! Thank you very much for your time and the references you showed me! Finally I managed to achieve what I was looking for! Here's the code I use if someone is interested on the same thing.

      On custom <head> content:

      <script>
          jQuery(document).ready(function(){
            jQuery(window).scroll(function() { // check if scroll event happened
              if (jQuery(document).scrollTop() > 25) { // check if user scrolled more than 50 from top of the browser window
                jQuery(".navbar").css("background-color", "#ffffff"); // if yes, then change the color of class "navbar" to white (#ffffff)
              } else {
                jQuery(".navbar").css("background-color", "transparent"); // if not, change it back to transparent
              }
            });
          });
      </script>
      

      On custom CSS:

      .navbar {
      transition: background-color 200ms linear;
      }
      

      Also on the "Customize" section the navbar must be on opacity 0.

      That's all! Thank you again for your help and have a good day! :D

      E 1 Reply Last reply
      1
      • RichardR Offline
        RichardR Offline
        Richard
        Global Moderator
        wrote on last edited by
        #8

        Dear @antonioprado

        Amazing! thank you heaps for posting your success and helping to make the Lay Theme Community stronger,
        So cool that you made it work :_)

        Have a wonderful rest of the week

        Best
        Richard

        1 Reply Last reply
        0
        • A antonioprado

          @Richard-Keith Hello! Thank you very much for your time and the references you showed me! Finally I managed to achieve what I was looking for! Here's the code I use if someone is interested on the same thing.

          On custom <head> content:

          <script>
              jQuery(document).ready(function(){
                jQuery(window).scroll(function() { // check if scroll event happened
                  if (jQuery(document).scrollTop() > 25) { // check if user scrolled more than 50 from top of the browser window
                    jQuery(".navbar").css("background-color", "#ffffff"); // if yes, then change the color of class "navbar" to white (#ffffff)
                  } else {
                    jQuery(".navbar").css("background-color", "transparent"); // if not, change it back to transparent
                  }
                });
              });
          </script>
          

          On custom CSS:

          .navbar {
          transition: background-color 200ms linear;
          }
          

          Also on the "Customize" section the navbar must be on opacity 0.

          That's all! Thank you again for your help and have a good day! :D

          E Offline
          E Offline
          ERSI19
          wrote on last edited by
          #9

          @antonioprado said in Transparent Navbar (header):

          .navbar {
          transition: background-color 200ms linear;
          }

          Thank you very much, where do I have to place this? custom <head> content.?

          A 1 Reply Last reply
          0
          • E ERSI19

            @antonioprado said in Transparent Navbar (header):

            .navbar {
            transition: background-color 200ms linear;
            }

            Thank you very much, where do I have to place this? custom <head> content.?

            A Offline
            A Offline
            alasdair17
            wrote on last edited by
            #10

            @ERSI19 hey, you need to paste it into the 'Custom CSS' box.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              LouisS
              wrote on last edited by
              #11

              Hi,
              Thanks for the script. Works great! Anybody knows how I can add a blur instead of just having the menu bar just white? I found this backdrop filter, but don't really know how to implement it. Help is much appreciated!

              -webkit-backdrop-filter: blur(8px);
              backdrop-filter: blur(8px);
              

              Best,Louis

              1 Reply Last reply
              0
              • L Offline
                L Offline
                LouisS
                wrote on last edited by
                #12

                Now I figured it out. DOnt know why it didnt work in the beginning. Added the blur filter and some transperancy with the rgba.

                <script>
                    jQuery(document).ready(function(){
                      jQuery(window).scroll(function() { // check if scroll event happened
                        if (jQuery(document).scrollTop() > 50) { // check if user scrolled more than 50 from top of the browser window
                            jQuery(".navbar").css("background-color", "rgba(255, 255, 255, 0.4)"); // if yes, then change the color of class "navbar" to white (#ffffff) and 0.4 opacity
                         // jQuery(".navbar").css("background-color", "#ffffff"); // if yes, then change the color of class "navbar" to white (#ffffff)
                            jQuery(".navbar").css("backdrop-filter", "blur(5px)"); // if yes, then change the blur to 5px
                        } else {
                            jQuery(".navbar").css("background-color", "transparent"); // if not, change it back to transparent
                            jQuery(".navbar").css("backdrop-filter", "blur(0px)"); // if yes, then change the blur to 0px
                
                        }
                      });
                    });
                </script>
                
                arminunruhA 1 Reply Last reply
                1
                • L LouisS

                  Now I figured it out. DOnt know why it didnt work in the beginning. Added the blur filter and some transperancy with the rgba.

                  <script>
                      jQuery(document).ready(function(){
                        jQuery(window).scroll(function() { // check if scroll event happened
                          if (jQuery(document).scrollTop() > 50) { // check if user scrolled more than 50 from top of the browser window
                              jQuery(".navbar").css("background-color", "rgba(255, 255, 255, 0.4)"); // if yes, then change the color of class "navbar" to white (#ffffff) and 0.4 opacity
                           // jQuery(".navbar").css("background-color", "#ffffff"); // if yes, then change the color of class "navbar" to white (#ffffff)
                              jQuery(".navbar").css("backdrop-filter", "blur(5px)"); // if yes, then change the blur to 5px
                          } else {
                              jQuery(".navbar").css("background-color", "transparent"); // if not, change it back to transparent
                              jQuery(".navbar").css("backdrop-filter", "blur(0px)"); // if yes, then change the blur to 0px
                  
                          }
                        });
                      });
                  </script>
                  
                  arminunruhA Offline
                  arminunruhA Offline
                  arminunruh
                  Global Moderator
                  wrote on last edited by
                  #13

                  nice!

                  you can also do it like this:

                  jQuery(window).scroll(function() { // check if scroll event happened
                          if (window.scrollY > 50) { // check if user scrolled more than 50 from top of the browser window
                              jQuery(".navbar").css("background-color", "rgba(255, 255, 255, 0.4)"); // if yes, then change the color of class "navbar" to white (#ffffff) and 0.4 opacity
                           // jQuery(".navbar").css("background-color", "#ffffff"); // if yes, then change the color of class "navbar" to white (#ffffff)
                              jQuery(".navbar").css("backdrop-filter", "blur(5px)"); // if yes, then change the blur to 5px
                          } else {
                              jQuery(".navbar").css("background-color", "transparent"); // if not, change it back to transparent
                              jQuery(".navbar").css("backdrop-filter", "blur(0px)"); // if yes, then change the blur to 0px
                  
                          }
                        });
                  

                  u dont need a ready handler for this and you can use window.scrollY

                  L 1 Reply Last reply
                  0
                  • arminunruhA arminunruh

                    nice!

                    you can also do it like this:

                    jQuery(window).scroll(function() { // check if scroll event happened
                            if (window.scrollY > 50) { // check if user scrolled more than 50 from top of the browser window
                                jQuery(".navbar").css("background-color", "rgba(255, 255, 255, 0.4)"); // if yes, then change the color of class "navbar" to white (#ffffff) and 0.4 opacity
                             // jQuery(".navbar").css("background-color", "#ffffff"); // if yes, then change the color of class "navbar" to white (#ffffff)
                                jQuery(".navbar").css("backdrop-filter", "blur(5px)"); // if yes, then change the blur to 5px
                            } else {
                                jQuery(".navbar").css("background-color", "transparent"); // if not, change it back to transparent
                                jQuery(".navbar").css("backdrop-filter", "blur(0px)"); // if yes, then change the blur to 0px
                    
                            }
                          });
                    

                    u dont need a ready handler for this and you can use window.scrollY

                    L Offline
                    L Offline
                    LouisS
                    wrote on last edited by
                    #14

                    @arminunruh Thanks! I am very new to this and just copy paste pieces together :)
                    How can I exclude the mobile menu bar from my script? I want it to become 100% opacity instead of 0%. How do I just target the desktop menu bar without the mobile menu bar? I am having the script in Custom head content right now.
                    Best,
                    Louis

                    1 Reply Last reply
                    0
                    • arminunruhA Offline
                      arminunruhA Offline
                      arminunruh
                      Global Moderator
                      wrote on last edited by arminunruh
                      #15
                      jQuery(window).scroll(function() { // check if scroll event happened
                      if( window.innerWidth > 700 ) {
                      
                              if (window.scrollY > 50) { // check if user scrolled more than 50 from top of the browser window
                                  jQuery(".navbar").css("background-color", "rgba(255, 255, 255, 0.4)"); // if yes, then change the color of class "navbar" to white (#ffffff) and 0.4 opacity
                               // jQuery(".navbar").css("background-color", "#ffffff"); // if yes, then change the color of class "navbar" to white (#ffffff)
                                  jQuery(".navbar").css("backdrop-filter", "blur(5px)"); // if yes, then change the blur to 5px
                              } else {
                                  jQuery(".navbar").css("background-color", "rgba(255, 255, 255, 1);
                                  jQuery(".navbar").css("backdrop-filter", "blur(0px)"); // if yes, then change the blur to 0px
                      }
                              }
                            });
                      
                      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
                      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