Jump to content

yeshidesigns

Member
  • Posts

    6
  • Joined

  • Last visited

Posts posted by yeshidesigns

  1. On 6/24/2020 at 6:30 PM, rwp said:

    jQuery 3.5.1 (you will need to add in the jQuery script as well, its available from https://code.jquery.com/ I use minified.

    Upload the image that you want to use as the top image to the header in Squarespace

    Supply the url for top image and scroll image (its important that this matches the one you uploaded)

    The code will set the image class to "logo", it does this by using your alt tag, which is the only identifier Squarespace gave that img tag.

    After scrolling more than 100px, it will replace the image, change the value from 50 if you want it more or less.

    
    var topIMG = "";
    var sclIMG = "";
    
    $('img[alt="Gabriela Silveira"]').attr("class", "logo")
    
    $(window).scroll(function() {
       var value = $(this).scrollTop();
       if (value > 50)
          $(".logo").attr("src", sclIMG);
       else
          $(".logo").attr("src", topIMG);
    });

     

    Hey there, are you able to share the full code needed? I added in the jQuery 3.5.1 script but was confused where to add images and format the above.

×
×
  • 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.