Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1079568
    Timmy
    Participant

    Hi!

    I just can’t figure it out. I want my navbar font to change color when scrolling, no problem with that but it doesn’t change back the original color when scrolling all the way up again.

    My CSS-code right now is:

    .x-navbar .x-nav-wrap.desktop li a span {
        color: #fff;
    }
    
    .x-navbar.x-navbar-fixed-top .x-nav-wrap.desktop li a span {
        color: #2b2b2b;
    }
    

    URL: http://timanity.se/

    Thanks in advance!
    Timmy

    #1079918
    Christopher
    Moderator

    Hi there,

    Please remove CSS and add this code in Custom -> JavaScript :

    jQuery(document).ready(function($){
    	$(window).scroll(function(){
    		if ($(this).scrollTop() > 50) {
    			$('.x-navbar li a').css("color","#2b2b2b");
    		} else {
    			$('.x-navbar li a').css("color","#fff");
    		}
    	});
    });

    Hope that helps.

    #1080071
    Timmy
    Participant

    Thank you soo much!! 🙂

    #1080076
    Christopher
    Moderator

    You’re welcome.

    #1080078
    Timmy
    Participant

    Kind of helped me!

    But the problem now is that when the page loads up it looks like this:
    Blue navbar links

    When I scroll down it’s good:
    Scroll down

    And when I scroll up again, same thing it looks perfect:
    Scroll up good

    So why isn’t the links white when the page loads up?

    #1080088
    Christopher
    Moderator

    Please update JS code to :

    jQuery(document).ready(function($){
    	$(window).scroll(function(){
    		if ($(this).scrollTop() > 50) {
    			$('.x-navbar.x-navbar-fixed-top li a span').css("color","#2b2b2b");
    		} else {
    			$('.x-navbar.x-navbar-fixed-top li a span').css("color","#fff");
    		}
    	});
    });

    Add this CSS as well :

    .x-navbar li a span{
    color:#fff;
    }

    Hope it helps.

    #1080355
    Timmy
    Participant

    Awesome! Thank you soo much!! 😀

    #1080379
    Rupok
    Member

    You are welcome!

    Glad that it helped. Feel free to let us know if you face any other issue. We’ll be happy to assist you.

    Thanks for using X.

    Cheers!

    #1081749
    Timmy
    Participant

    Hello again!

    is it possible to have this on only one page? 🙂

    #1081977
    Joao
    Moderator

    Hi There,

    Yes it is.

    Would you mind letting us know which page you would like to achieve this effect?

    If it is your home page try using this code instead:

    
    jQuery(document).ready(function($){
    	$(window).scroll(function(){
    		if ($(this).scrollTop() > 50) {
    			$('.home .x-navbar.x-navbar-fixed-top li a span').css("color","#2b2b2b");
    		} else {
    			$('.home.x-navbar.x-navbar-fixed-top li a span').css("color","#fff");
    		}
    	});
    });

    Let us know how it goes.

    Thanks

    Joao

    #1083501
    Timmy
    Participant

    .page-id-53 is the one I want to achieve it on 🙂

    #1083654
    Joao
    Moderator

    Hi There,

    Try this instead:

    
    jQuery(document).ready(function($){
    	$(window).scroll(function(){
    		if ($(this).scrollTop() > 50) {
    			$('.page-id-53 .x-navbar.x-navbar-fixed-top li a span').css("color","#2b2b2b");
    		} else {
    			$('.page-id-53 .x-navbar.x-navbar-fixed-top li a span').css("color","#fff");
    		}
    	});
    });

    Hope that helps

    Joao

    #1083670
    Timmy
    Participant

    Yes! Awesome! Thank you! 🙂

    #1084133
    Nico
    Moderator

    Happy to hear that.

    Feel free to ask us again

    Thanks.

    #1118818
    Timmy
    Participant

    Hi again!

    I have a drop-down menu and the links inside doesn’t show on the home page. P.S Is there a way to make the navbar not transparent when you click on the drop-down menu on mobile?

    http://timanity.se/

  • <script> jQuery(function($){ $("#no-reply-1079568 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>