Website Building » Squarespace » How Do I Create a Pop Up Window in Squarespace?

How Do I Create a Pop Up Window in Squarespace?

Last updated on December 13, 2022 @ 1:21 am

There are two ways to create pop up windows in Squarespace: using the Pop-Up Window block, or by adding custom code.

The Pop-Up Window block is the easiest way to create a pop-up window. To use this block, simply add it to your page and then click on the “Edit” button.

In the editor, you can add your content and then style it using the various options available. Once you’re happy with your pop-up window, simply click on the “Save” button and then preview your page to see it in action.

If you want more control over your pop-up window, or if you want to add other features such as a closing button, you can add custom code. To do this, first create a new Code Block and then paste in the following code:

< script >
window.onload = function() {
var popup = document.getElementById('popup');
popup.style.visibility = 'visible';
}
< /script >

You can then style the popup div using CSS to control its appearance. To close the popup, you’ll need to add a button or link with the following code:

< a href="#" onclick="document.getElementById('popup').visibility = 'hidden';" >Close< /a >

That’s all there is to creating a pop-up window in Squarespace!

PRO TIP: Please be aware that creating a pop up window in Squarespace can be difficult and may not work as intended. We recommend only experienced users attempt this.
Dale Leydon

Dale Leydon

Sysadmin turned Javascript developer. Owner of 20+ apps graveyard, and a couple of successful ones.