Tagged: x
-
AuthorPosts
-
March 3, 2017 at 1:24 pm #1393665
nlwebdesignParticipantWebsite: https://nlwebdesign.com
I have the header transparent currently on the homepage only, which is what I want. However, I need the fixed header on scroll to change the background to black. Only on the homepage.
Please help.
March 4, 2017 at 12:13 am #1394145
RadModeratorHi there,
Thanks for writing in.
Please add this code to Admin > Appearance > Customizer > Custom > Javascript
jQuery( function($){ $(window).scroll( function() { if( $(this).scrollTop() > 10 ) { $('.home .x-navbar').css({ backgroundColor : '#000' }); } else { $('.home .x-navbar').css({ backgroundColor : 'transparent' }); } } ); } );Then please remove this existing CSS
.home .x-navbar { background: transparent !important; }and change this existing CSS
@media (min-width:979px){ .home .masthead.masthead-inline { position: absolute; width: 100%; } .home .x-navbar { background: transparent !important; } }to this
@media (min-width:979px){ .home .masthead.masthead-inline { position: absolute; width: 100%; } }In summary, you have added this CSS twice and they should be removed. Else, the above code will not work.
.home .x-navbar { background: transparent !important; }Then last, let’s add easing/fade effect by adding this CSS.
.x-topbar, .x-navbar { -webkit-transition: all 1s; transition: all 1s; }Cheers!
March 4, 2017 at 4:24 pm #1394638
nlwebdesignParticipantLooks Great! Thank you.
March 4, 2017 at 4:29 pm #1394640
nlwebdesignParticipantWait! Now the page loads with the header background black instead of transparent. It’s only supposed to change once it scrolls. If I scroll and then go back to the top it becomes transparent, but it’s supposed to load the page starting as transparent.
Make sense?
March 5, 2017 at 3:23 am #1394921
ChristopherModeratorHi there,
Please add this code :
.x-navbar { background-color: transparent; }Remove extra curly bracket from following code :
.hs-responsive-embed-youtube iframe { position: absolute; width: 100%!important; height: 100%!important; } }Close curly bracket for following code :
.x-nav #menu-item-1927 a { padding-top: 20px;Hope it helps.
March 6, 2017 at 2:44 pm #1396746
nlwebdesignParticipantYes, Thank you. Looks good.
March 6, 2017 at 3:08 pm #1396785
JoaoModeratorGlad to hear it 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1393665 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
