Jump to content

[Share] Click Navigation Link - Open Form Popup

Recommended Posts

If you can't make it work, you can share site url, I can help easier.

#1. First, you need to edit Site Footer

image.png.33293100ad1e6087a7052a9a9e596424.png

#2. And add a Form Block

image.thumb.png.86a04fe516442520f59ce1400b8947f6.png

#3. Click Design > Enable Lightbox

image.png.3039f0c8b4749396370888694227eeb9.png

#4. Add a Link item in Main Navigation > Enter text/URL

  • Text: enter any text that you want, in my example, we will use “Contact“
  • URL: #contact

Make sure the option “Open link in new tab” is disabled

image.png.6e33a8a0b6ce5c49f11d280d394629e3.png

#5. Use this code to Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $('header#header [href*="#contact"]').on("click", function(event){
      event.preventDefault();
    $('button.lightbox-handle')[0].click();
  })
})
</script>

image.png.81825f77e4292ca9339b1b8b9677ecf0.png

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
  • 5 weeks later...
  • Replies 8
  • Views 857
  • Created
  • Last Reply

Top Posters In This Topic

8 hours ago, flyfishingnerd said:

@tuanphan This is extremely helpful, thanks! The issue I am running into is that this approach works when tested in Squarespace Editor mode, but when I test on my webpage the popup form never becomes visible... any clue why that would be?

Can you share your site url?

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
  • 1 month later...
7 hours ago, flyfishingnerd said:

@tuanphan sorry for the delayed response. All steps are currently enabled on my website trailheadcrossfit.com. Still the same issue where the code works when I am in Squarespace Editor, but the lightbox/form does not pop up when in browser.

This should be 1 number 0

000000 is invalid

image.png.70acb063ade9a5e157abd0b18955a56e.png

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
3 hours ago, flyfishingnerd said:

@tuanphan Thanks, but even after updated to a single '0' I still have the same issue.

#5. Try this code for step 5

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
  $(document).ready(function() {
    $('a[href="#contact"]').on("click", function(event) {
        event.preventDefault();
        $('button.lightbox-handle').click(); 
    });
});
</script>

 

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

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.