Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1101466
    Tim
    Participant

    Hi X,

    I have used some code to change the logo on scroll. When you first enter the page (http://comhsc-siiksaare.savviihq.com/product/graco-husky-205-membraanpomp/). You see the first logo, on scroll it changes to second. This works fine. Without the topbar activated, when scrolling to top, it changes back to the first logo. With the topbar activated, it does not.

    You guys have a clue what might causing this?

    The code used:

    jQuery(function($) {
    	$(window).scroll(function() {
    		var scrollPos = $(window).scrollTop(),
    			width = $(window).width();
    		if($(".x-navbar").hasClass("x-navbar-fixed-top") && scrollPos > 25 && width > 200) {
    			$(".x-navbar-fixed-top .x-brand img").attr("src","http://comhsc-siiksaare.savviihq.com/wp-content/uploads/2016/07/hsc-pumps-graco-specialist-beeld3.svg");
    		} else {
    			$(".x-navbar-fixed-top .x-brand img").attr("src","http://comhsc-siiksaare.savviihq.com/wp-content/uploads/2016/07/hsc-pumps-graco-specialist-logo-w.svg");
    		}
    	});
    });

    Cheers!

    #1101488
    Rupok
    Member

    Hi there,

    Let’s update the code a bit :

    jQuery(function($) {
    	$(window).scroll(function() {
    		var scrollPos = $(window).scrollTop(),
    			width = $(window).width();
    		if($(".x-navbar").hasClass("darknavbar") && scrollPos > 25 && width > 200) {
    			$(".x-navbar .x-brand img").attr("src","http://comhsc-siiksaare.savviihq.com/wp-content/uploads/2016/07/hsc-pumps-graco-specialist-beeld3.svg");
    		} else {
    			$(".x-navbar .x-brand img").attr("src","http://comhsc-siiksaare.savviihq.com/wp-content/uploads/2016/07/hsc-pumps-graco-specialist-logo-w.svg");
    		}
    	});
    });

    Hope this helps.

    Cheers!

    #1101585
    Tim
    Participant

    Hi Rupok,

    Works like a charm. Thanks so much:)

    Have a great day!

    Cheers!

    #1101625
    Christian
    Moderator

    You’re welcome. Glad we could help. 🙂

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