DevonLois Posted June 18, 2020 Posted June 18, 2020 Site URL: https://www.freeformgroup.org/phoenix-rising-1 I have a markdown accordion on my site that only works after the page is reloaded. Is this an ajax problem? Here is the javascript I'm using that has worked fine on other sites: <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> $(document).ready(function(){ $('.markdown-block .sqs-block-content h2').css('cursor','pointer'); $(".markdown-block .sqs-block-content h2").nextUntil("h2").slideToggle(); $(".markdown-block .sqs-block-content h2").click(function() {$(this).nextUntil("h2").slideToggle();}); }); </script>
Beyondspace Posted June 18, 2020 Posted June 18, 2020 Hi DevonLois Did you try to turn off ajax? I think the issue comes from the script not first again when you navigate to the page via ajax 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
Beyondspace Posted June 18, 2020 Posted June 18, 2020 20 minutes ago, DevonLois said: Site URL: https://www.freeformgroup.org/phoenix-rising-1 I have a markdown accordion on my site that only works after the page is reloaded. Is this an ajax problem? Here is the javascript I'm using that has worked fine on other sites: <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> $(document).ready(function(){ $('.markdown-block .sqs-block-content h2').css('cursor','pointer'); $(".markdown-block .sqs-block-content h2").nextUntil("h2").slideToggle(); $(".markdown-block .sqs-block-content h2").click(function() {$(this).nextUntil("h2").slideToggle();}); }); </script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script> $(document).ready(function() { window.addEventListener('mercury:load', function() { $('.markdown-block .sqs-block-content h2').css('cursor','pointer'); $(".markdown-block .sqs-block-content h2").nextUntil("h2").slideToggle(); $(".markdown-block .sqs-block-content h2").click(function() {$(this).nextUntil("h2").slideToggle();}); }); }); </script> Reference: https://stackoverflow.com/questions/47509602/squarespace-ajax-loading-do-not-display-custom-code 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.