Jump to content

Auto-scrolling Gallery "Reel" Section

Recommended Posts

Posted

Hello,

I have a gallery reel which I'd like to auto-scroll. I currently have a script that does work, however, it makes me unable to edit the site once its enabled. Is there any way around that? Here is my script:

 


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
jQuery(document).ready(function($){
	setInterval(function(){ 
	$('.gallery-reel-control-btn[data-next]').click()
	},3500);
})
</script>

 

Thanks!

  • 1 month later...
Posted (edited)
On 2/2/2024 at 10:59 PM, CallumT said:

Hello,

I have a gallery reel which I'd like to auto-scroll. I currently have a script that does work, however, it makes me unable to edit the site once its enabled. Is there any way around that? Here is my script:

 


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
jQuery(document).ready(function($){
	setInterval(function(){ 
	$('.gallery-reel-control-btn[data-next]').click()
	},3500);
})
</script>

 

Thanks!

Updated script to use plain Javascript and stops if it is in edit mode

<script>
  if (window.self === window.top) {
    document.addEventListener("DOMContentLoaded", function() {
      setTimeout(function() {
        const nextButton = document.querySelector('.gallery-reel-control-btn[data-next]');
        if (nextButton) {
          nextButton.click();
        }
      }, 3500);
    });
  }
</script>

 

Edited by Beyondspace

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - PDF Lightbox popup - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> No-code customisations for Squarespace

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.