Jump to content

Add 'Donate' Button back into navigation bar

Recommended Posts

Posted

Site URL: https://www.humanitascharity.org

Screenshot2024-11-28at23_35_14.thumb.png.7bc0e35a6fb9a934dab07f4e15386e2c.png

I’m working on updating a charity website running on version 7.0. The site is a bit outdated, and I’ve noticed that the "Donate" button in the top navigation bar is now missing. I’ve attached an image above of how the navigation bar looked before for reference. You can see it in the top right of the navigation bar. 

I’d really appreciate any advice on how to add the "Donate" button back. Thanks so much for your help!

  • Replies 5
  • Views 74
  • Created
  • Last Reply

Top Posters In This Topic

Posted (edited)

i check don't seen any button there ? can you pls add again so we set through css.

Edited by paramjeet.kour08

Hi ! I am Paramjeet kaur Top rated SquareSpace Web Designer and Web Developer with SEO For Web Sites. Working Now As freelancer With lowest Rate. Rate $20 per hour.  Till date, I have created over 300 + websites in Squarespace.  Contact Me    Email

Posted (edited)

Add this code into pages > web tools > code injection > footer:

document.addEventListener("DOMContentLoaded", () => {
  // Select the target container
  const headerDesktop = document.querySelector(".header-display-desktop");

  if (headerDesktop) {
    // Create the button element
    const donateButton = document.createElement("button");
    donateButton.className = "donate-button";
    donateButton.textContent = "Donate";

    // Append the button to the header-display-desktop
    headerDesktop.appendChild(donateButton);

    // Style the button
    const style = document.createElement("style");
    style.textContent = `
      .donate-button {
        background-color: #ff4500; /* Bright orange */
        color: white;
        font-size: 1rem;
        padding: 10px 20px;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        transition: background-color 0.3s ease;
        margin-left: auto;
      }
      .donate-button:hover {
        background-color: #e63900; /* Darker orange on hover */
      }
      .header-display-desktop {
        display: flex;
        align-items: center;
      }
    `;
    document.head.appendChild(style);
  }
});

 

Edited by Squareko

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.