Jump to content

JS Code Help in Markdown

Recommended Posts

Hi all,

I am having a heck of a time with Mindbody and 7.1. 

I need to put some JS in either a Markdown block accordion or the new SS accordion block. This enables a lightbox for users to purchase something in Mindbody. 

I prefer to use the new SS accordion block but it appears no code can be added yet and the MB code will not work as links anymore. 

I am trying to add this code to a Markdown block...

<script src="https://widgets.mindbodyonline.com/javascripts/healcode.js" type="text/javascript"></script><healcode-widget data-version="0.2" data-link-class="healcode-contract-text-link" data-site-id="37670" data-mb-site-id="618848" data-bw-identity-site="false" data-type="contract-link" data-inner-html="$99 / per month" data-service-id="104" />

The healcode text is staying visible and not working. Any suggestions? 

site: https://soul-fenton.squarespace.com/studio
pw: soul

It's the first accordion on the page, I've been trying a bunch to get them to work. 

Link to comment

The reason it's not working in a markdown block is because mindbody have used a custom element that includes a hyphen and squarespace doesn't like that when it preprocesses tags in a markdown block (that's why you see "healcode-widget" becoming "healcode data-preserve-html-node="true"-widget".

you'd need to put your code into a code block rather than a markdown one and it will work just fine. I don't think it will work in the new Squarespace Accordion block without writing some extra code as the Accordion block just takes a basic text block in its description property.

so I guess these are your options:

  • put the links into a code block and don't use the accordion block
  • put the links into a code block and use further code to move them into the accordion block
  • put normal links into the accordion block and then use code to intercept the clicks and programmatically open the lightbox

One other option would be to modify the relatively simple script that mindbody have provided to make it use a custom html element that doesn't have a hyphen in it, then edit the markdown should work just fine. you'd have to customise their script yourself to do that, but it wouldnt be that hard as the js they've provided itsn't minified and is easily readable.

 

Dave Hart. Software/Technology Consultant living in London. buymeacoffee 

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.