siaeva Posted July 27, 2021 Posted July 27, 2021 Site URL: https://brine-demo.squarespace.com/How would you rewrite this script so it works despite the Ajax loading on the Brine template? Right now it only works if you refresh the page. <script> $(document).ready(function(){ $('.markdown-block .sqs-block-content h3').css('cursor','pointer'); $(".markdown-block .sqs-block-content h3").nextUntil("h3").slideToggle(); $(".markdown-block .sqs-block-content h3").click(function() {$(this).nextUntil("h3").slideToggle();}); }); </script>
Beyondspace Posted July 28, 2021 Posted July 28, 2021 6 hours ago, siaeva said: Site URL: https://brine-demo.squarespace.com/ How would you rewrite this script so it works despite the Ajax loading on the Brine template? Right now it only works if you refresh the page. <script> $(document).ready(function(){ $('.markdown-block .sqs-block-content h3').css('cursor','pointer'); $(".markdown-block .sqs-block-content h3").nextUntil("h3").slideToggle(); $(".markdown-block .sqs-block-content h3").click(function() {$(this).nextUntil("h3").slideToggle();}); }); </script> try <script> $(document).ready(function(){ accordionTrigger(); }); window.addEventListener('mercury:load', accordionTrigger); function accordionTrigger(){ $('.markdown-block .sqs-block-content h3').css('cursor','pointer'); $(".markdown-block .sqs-block-content h3").nextUntil("h3").slideToggle(); $(".markdown-block .sqs-block-content h3").click(function() {$(this).nextUntil("h3").slideToggle();}); } </script> BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
Recommended Posts
Archived
This topic is now archived and is closed to further replies.