cookiemonster Posted March 12 Share Posted March 12 Hello! I'm trying to design a single page with TWO automatically scrolling carousels. I injected the following code into my footer, but it only made ONE of the carousels auto scroll. The second carousel only scrolls when clicked. I placed the carousels in different sections (instead of the same section), but that didn't help. Any idea how to correct this issue? Cheers 🙂 <!-- Summary Block Autoplay --> <script> window.onload = function() { var nextArrow = document.querySelector(".summary-carousel-pager-next"); function clickNext() { nextArrow.click(); } setInterval(clickNext, 4000); }; </script> Link to comment
sorca_marian Posted March 12 Share Posted March 12 Hello! It is simple to solve. A new line of code will be needed. Include the link of the page so I can create the rest of the code. 👨🔧👨💻 Contact me for development and design work - Freelancer Software engineer, Architect, and Designer UI/UX 🙋♂️ Squarespace Custom Web Development & Design 📅 Manage Tasks, Take Notes, and Upload Related Images 📹 Squarespace Tutorials for free - YouTube📹 💯🚀 I have worked on over 200 Squarespace sites with custom code for over 9 years 🙋♂️ Let's connect on LinkedIn Link to comment
cookiemonster Posted March 12 Author Share Posted March 12 Ah, I see! Thank you very much. Here is the link for the page https://eewedding.squarespace.com/ourstory Link to comment
tuanphan Posted March 14 Share Posted March 14 On 3/13/2024 at 2:34 AM, cookiemonster said: Ah, I see! Thank you very much. Here is the link for the page https://eewedding.squarespace.com/ourstory Site url doesn't exist 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
cookiemonster Posted March 14 Author Share Posted March 14 So sorry, I just changed it to https://eetietheknot.squarespace.com/ourstory Beyondspace 1 Link to comment
sorca_marian Posted March 14 Share Posted March 14 Password? 👨🔧👨💻 Contact me for development and design work - Freelancer Software engineer, Architect, and Designer UI/UX 🙋♂️ Squarespace Custom Web Development & Design 📅 Manage Tasks, Take Notes, and Upload Related Images 📹 Squarespace Tutorials for free - YouTube📹 💯🚀 I have worked on over 200 Squarespace sites with custom code for over 9 years 🙋♂️ Let's connect on LinkedIn Link to comment
Solution Beyondspace Posted March 15 Solution Share Posted March 15 On 3/13/2024 at 1:30 AM, cookiemonster said: Hello! I'm trying to design a single page with TWO automatically scrolling carousels. I injected the following code into my footer, but it only made ONE of the carousels auto scroll. The second carousel only scrolls when clicked. I placed the carousels in different sections (instead of the same section), but that didn't help. Any idea how to correct this issue? Cheers 🙂 <!-- Summary Block Autoplay --> <script> window.onload = function() { var nextArrow = document.querySelector(".summary-carousel-pager-next"); function clickNext() { nextArrow.click(); } setInterval(clickNext, 4000); }; </script> Try <script> // Check if the window is loaded window.onload = function() { if (window.self !== window.top) { return; } // Function to simulate clicking the next arrow function clickNext(arrow) { arrow.click(); } // Query all elements with the class for carousel next arrows var nextArrows = document.querySelectorAll(".summary-carousel-pager-next"); // Set auto-scrolling for each carousel nextArrows.forEach(function(arrow) { // Define a function to handle auto-scrolling for a specific carousel function autoScroll() { clickNext(arrow); setTimeout(autoScroll, 4000); // Set the next auto-scroll after 4 seconds } // Start the auto-scrolling for the current carousel autoScroll(); }); } </script> If you want all your summaries on your site to auto run, place this code in your site Footer injection. Otherwise place it into each Page code injection cookiemonster 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace (+100 Spark plugin customisations) 🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates) If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
cookiemonster Posted March 15 Author Share Posted March 15 Wow, brilliant! Many thanks! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment