Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1257731
    yhshin1020
    Participant

    Hey,

    I went ahead and used the solution from other threads to customise my header logo on different pages using this jquery:

    jQuery(".page-id-1357 .x-brand img").attr("src","http://www.guidedogssg.com/wp-content/uploads/2016/07/unnamed.png");

    The code works perfectly fine when you load the page but when I have a Javascript script suggested by one of the support staff that makes the header change size and color when you scroll down. (https://community.theme.co/forums/topic/header-that-resizes-when-scrolling-down/)

    So on page load the alternate logo is showing up fine but when you scroll down and then back up the logo turns white again (to the normal logo uploaded in customiser).

    how can I fix the image from returning back to normal?

    Thanks.

    #1257734
    yhshin1020
    Participant
    This reply has been marked as private.
    #1257864
    Paul R
    Moderator

    Hi,

    Please change your js code to this.

    
    jQuery(function($) {
        $('.x-navbar-fixed-top').css("background-color", "transparent");
        $(window).scroll(function(){
            if ($(this).scrollTop() >10) {
                $('.x-navbar-fixed-top').css("background-color", "#fff");
                            $('.x-brand img').css("width", "70px");
                            $('.x-navbar-fixed-top .x-brand img').attr('src','http://www.guidedogssg.com/wp-content/uploads/2016/07/unnamed.png');
            } else {
                $('.x-navbar-fixed-top').css("background-color", "transparent"); 
                            $('.x-barnd img').css("width", "80%");
                            $('.x-brand img').attr('src','http://www.guidedogssg.com/wp-content/uploads/2016/10/Untitled-1-1.png');
                            $(".page-id-1357 .x-brand img").attr("src","http://www.guidedogssg.com/wp-content/uploads/2016/07/unnamed.png");
            }
        });
         $(window).scroll(function(){ 
            if($(window).scrollTop()<=0) {
                  $('.x-navbar').removeClass("x-navbar-fixed-top");
          }
        });
    });
    

    Hope that helps

    #1257894
    yhshin1020
    Participant
    This reply has been marked as private.
    #1257973
    Rahul
    Moderator

    Hey There,

    Thanks for writing back!

    Everything seems to be working fine on my end.

    Can you please confirm it by double checking it?

    Thanks for understanding!

    #1258011
    yhshin1020
    Participant

    My bad, its showing up on my phone only!

    Thanks!!

    #1258086
    Joao
    Moderator

    Glad to hear we managed to help,

    Please let us know if you need help with anything else.

    Joao

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