Brent_Dickens Posted January 2, 2022 Posted January 2, 2022 Site URL: https://www.trickofthelight.co.nz/shows/lysanders-aunty I am using the Squarestudio Content Accordion plugin for a site: http://demo.squarestud.io/content-accordion Sadly they are not responding to my help requests. My clients site is having an issue where if one accordion is open then you click on another it scrolls to the bottom of the page rather than closing the open one and moving to the correct position. The page is here: https://www.trickofthelight.co.nz/shows/lysanders-aunty If you scroll to the bottom and then open the 'Credits' accordion then the media accordion you will see what I mean. Any help would be appreciated as my client would love to have this one solved. Source code is below: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script> $(document).ready(function(){ init(); //Start the code when the page loads }) function init(){ $('.sqs-block-markdown').nextUntil('.sqs-block-markdown, .sqs-block-code').slideUp(); //Your code (wrapped in a function) $('.sqs-block-markdown').unbind().click(function(){ $('.sqs-block-markdown').not(this).nextUntil('.sqs-block-markdown, .sqs-block-code').slideUp(), $('.sqs-block-markdown').not(this).removeClass('activedrop'), $(this).nextUntil('.sqs-block-markdown, .sqs-block-code').slideToggle(); $(this).toggleClass('activedrop') }); $('.sqs-block-markdown').css('cursor','pointer');; } document.addEventListener('pageChange', function(){ //When the change page event fires due to ajax init(); //Call the code again }); /*This stuff listens for an ajax page change*/ window.onload = watch; function watch(){MutationObserver=window.MutationObserver||window.WebKitMutationObserver;var a=new MutationObserver(function(a){for(var b=0;b<a.length;b++){var c=a[b];if("attributes"===c.type){var d=new Event("pageChange");document.dispatchEvent(d)}}});a.observe(document.body,{attributes:!0,attributeFilter:["id"]})} </script> <style> .sqs-block-markdown { border-bottom: solid 1px #ddd; cursor:pointer; } .sqs-block-markdown .sqs-block-content:before { content: "+"; float: right; font-size: 150%; line-height: 120%; color: #aaa; font-weight: 100; } .activedrop .sqs-block-content:before { content: "-" !important; float: right; font-size: 150%; line-height: 100%; color: #aaa; font-weight: 100; } </style>
conversiontracking Posted January 2, 2022 Posted January 2, 2022 Sorry to hear you're not getting a response 😕 Us plugin developers are often small studios, sometimes just 1 person so if they've gotten sick they might take a while to respond. However, if you've bought a license to a plugin and pasted the code here you're very likely to break their terms and conditions by sharing the purchased code publicly. You should check and consider removing the code if that's the case. You could try this. It's far from perfect and likely to cause some headaches but it might temporarily help things out. <script> // ⬜️ domready START $( document ).ready(function() { $(".markdown-block").click(function() { var thiselement = $(this); setTimeout(function(){ $([document.documentElement, document.body]).animate({ scrollTop: thiselement.offset().top -50 }, 10); }, 300); }); }); // ⬛️ domready END </script> Freelance Squarespace developer making plugins like Full-Width Blocks, Hover effects for grid gallery and the Darkmode plugin. I know Squarespace inside out and I'm able to solve pretty much any Squarespace code problem. Get in touch here!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment