Jump to content

JS Code needed - show html on certain pages, exclude other pages

Recommended Posts

Site URL: https://www.90daybusinesslaunch.com

Hi all!

PW: Peaceout$2020

I'm adding HTML to my site-wide header that is creating a pop-up on the website. We'd like for the pop-up to be excluded, however, from appearing on a few pages. This pop up is going to change somewhat often. Therefore, rather than going in and adding this code on each individual page's header code, i'd like to put it in Site-wide header, with some Javascript that says to exclude the html from pages x,y,z.  Can  anyone provide JS that could make that happen? ( Could filter by page name or Page Content ID number?)   

This is the code for my pop-up that is injected into site-wide header:

<a href="#lightbox_popups2" data-timeout="3" data-expires="30" class="js-auto-open-lightbox" hidden></a>

 I am using the Lightbox Anything plug-in .

Thank you!

Rachel 

 

*************************************
Let's Make a Website!
Rachel (she/her) | Squarespace Websites
Link to comment
  • Replies 1
  • Views 617
  • Created
  • Last Reply

To hide lightbox on One Page, add this code to Page Header

<style>
  [href*="lightbox_popups2"] {
  	display: none !important;
  }
</style>

or add this to Design > Custom CSS

#page1-id, #page2-id, #page3-id {
  [href*="lightbox_popups2"] {
  	display: none !important;
  }
  }

Find ID with this guide.

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Archived

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.