Jump to content

Change/minimize logo on scroll with fixed header

Recommended Posts

Site URL: https://www.a1-berlin-de.com/

Hi to all,

I'm trying to minimize the A1-logo on my website when scrolling down and found a suggestion in the forum, but it doesn't work in my case. If I add in the jQuery script I get the information "Syntax Error on line 1" (see attachment). Could you perhaps helb me? The website ist https://www.a1-berlin-de.com/ and the password is "TEST". If you can help me it would be great if you could give me a complete code.

The second thing is the grey background behind the header. Is there perhaps a possibility to make it half transparent (80 %) when scrolling?


Thanks in advace!



This is the code that doesn't work:

<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>   var topIMG = "https://images.squarespace-cdn.com/content/5ef332f7515832774d90c2a4/1609430530526-QSPFV5FZBZ13DOXZGRFY/A1+Logo+w.png?content-type=image%2Fpng"; var sclIMG = "https://images.squarespace-cdn.com/content/5ef332f7515832774d90c2a4/1609430530526-QSPFV5FZBZ13DOXZGRFY/A1+Logo+w.png?content-type=image%2Fpng";
$('img[alt=„A1+Logo+w“]‘).attr("class", "logo")
$(window).scroll(function() {    var value = $(this).scrollTop();    if (value > 50)       $(".logo").attr("src", sclIMG);    else       $(".logo").attr("src", topIMG); });</script>

Link to comment
  • Replies 1
  • Views 744
  • Created
  • Last Reply


This topic is now archived and is closed to further replies.

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