Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #895095
    sendpire
    Participant

    Hey there,

    I want to change my logo to a simpler version of it after the viewer scrolls, and when he scrolls back up it should change to the original logo again.

    I already found a great thread in here with some Javascript code that I inserted and it changes the logo to a 2nd one after scrolling.

    My problem is, that the logo stays as the 2nd one even if the viewer scrolls back to the top. Can I change that somehow?

    #895096
    sendpire
    Participant
    This reply has been marked as private.
    #896129
    Friech
    Moderator

    Hi There,

    Thanks for writing in! Please update your code to this.

                  jQuery(document).ready(function($) {
                      $(window).scroll(function() {
                        var scrollPos = $(window).scrollTop();
    
                        if (scrollPos > 200) {
                          $('.x-brand img').attr('src','https://sendpwr.com/wp-content/uploads/2016/04/image-8-e1461319499834.png');
                        } else {
                          $('.x-brand img').attr('src','https://sendpwr.com/wp-content/uploads/2016/04/white-logo-cut.png');
                        }
                      });
                  });

    Hope it helps, Cheers!

    #896609
    sendpire
    Participant

    Worked awesome! Thanks 🙂

    #897324
    Thai
    Moderator

    Glad it worked 🙂

    If you need anything else please let us know.

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