Adding third button to Promotional Popup

To add third button to Promotional Popup in Squarespace.

Like this.

You can use this code to Code Injection > Footer

<script>
const newItems = [
  {text: 'Services', url: '/services'},
  {text: 'About', url: '/about'}
];
const addNavItems = () => {
  const interval = setInterval(() => {
    const ul = document.querySelector('[data-compound-type="popup-overlay-action"] ul');
    if (ul) {
      newItems.forEach(item => {
        const li = document.createElement('li');
        const a = document.createElement('a'); 
        a.href = item.url;
        a.textContent = item.text;
        li.appendChild(a);
        ul.insertBefore(li, ul.firstChild);
      });
      clearInterval(interval);
    }
  }, 100);
};
addNavItems();
</script>

You can change text/url here.

1 Like