Jump to content

Change logo on scroll with fixed header 7.1

Go to solution Solved by rwp,

Recommended Posts

On 7/22/2021 at 10:43 AM, scottneufeld said:

Hello,

Looking to continue this transition above but also change the cart & burger menu images.

Any advice?

 

 

var logoTopIMG = "insert photo file";
var logoSclIMG = "insert photo file";

var burgTopIMG = "insert photo file";
var burgSclIMG = "insert photo file"; 

var cartTopIMG = "insert photo file";
var cartSclIMG = "insert photo file"; 

$(window).scroll(function() {
   var value = $(this).scrollTop();
   if (value > 800)
      $(".header-title-logo img").attr("src", logoSclIMG);
      $(".burger-box").css("background-image").attr("src", burgSclIMG); 

      $(".cart").css("background-image").attr("src", burgSclIMG); 

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\Obviously incorrect, any pointers???

   else
      $(".header-title-logo img").attr("src", logoTopIMG);

etc...

});</script> 

Can you share link to your site?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.