Jump to content

Auto-scroll Gallery (Type - Slideshow:Reel)

Recommended Posts

On 7/8/2022 at 12:16 AM, tuanphan said:

Just tested the code on your site. It should work.

<script>
(function docReady(fn) {
    // see if DOM is already available
    if (document.readyState === "complete" || document.readyState === "interactive") {
        // call on next available tick
        setTimeout(fn, 1);
    } else {
        document.addEventListener("DOMContentLoaded", fn);
    }
})(() => {
    if ( window.location == window.parent.location ) {
      const reelControl = document.querySelector('.gallery-reel-control [aria-label="Next Slide"]');
      if (reelControl) {
        (function reelTimer() {          
            setTimeout(() => {
              reelControl.click();
              reelTimer();
            }, 2000);  // change this value to change the speed           
        })(); 
      }
    }
});
</script>

 

Tried this code in the footer section of code inject but it doesn't seem to be working for me

Link to comment
2 hours ago, travisfisher said:

Tried this code in the footer section of code inject but it doesn't seem to be working for me

Please post the URL for a page on your site where we can see your issue.

A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

Please set up a site-wide password, if your site is not public and you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site.

Please read the site-wide password and how to share a link documentation to understand how they work.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 5 weeks later...
  • 3 months later...

Hi I also added this to me site with the new code and it did not work. I am trying to get a reel gallery on my homepage to autoscroll through. Any advice on how to get this working? Thank you 

lauraevephotography.com

Edited by LauraEve
Link to comment
2 hours ago, penguininthefreezer said:

How would I set it to autoplay both of them?

Please post the URL for a page on your site where we can see your issue.

A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

Please set up a site-wide password, if your site is not public and you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site.

Please read the site-wide password and how to share a link documentation to understand how they work.

We can then take a look at your issue.

You may find How to post a forum question post useful.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
8 hours ago, clare1 said:

all the options above seem to require a higher level of account. Is there a way of making autoscroll but on a basic membership plan?

I'm not @tuanphan but the answer is no.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 6/19/2023 at 10:43 PM, SashaMiana said:

@tuanphan This has worked super well for me in sites I've built to display logos of featured clients. HOWEVER, the site I'm currently working on, I'm wanting to add a regular slideshow gallery reel, but when I add to the page, it disables this coding above. SOS. 

URL: www.lumieremarketing.co
PW: lmc123

You mean the code doesn't work on new gallery reel?

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
  • 2 months later...
6 hours ago, Sebbo said:

Works but globally across ALL slideshows on the website. What is the code to only apply it to a particular one?

Please post the URL for a page on your site where we can see your issue.

A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

Please set up a site-wide password, if your site is not public and you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site.

Please read the site-wide password and how to share a link documentation to understand how they work.

We can then take a look at your issue.

You may find How to post a forum question post useful.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 5 months later...
5 hours ago, artyp said:

It seems I can't get it working on my site...

The code you are using appears not to be from this thread. It is designed to auto click a Summary block. You have used a gallery section so you need to use code for a gallery section. This thread appears to contain several versions that might do the job.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 2/29/2024 at 9:50 PM, creedon said:

The code you are using appears not to be from this thread. It is designed to auto click a Summary block. You have used a gallery section so you need to use code for a gallery section. This thread appears to contain several versions that might do the job.

The code is from this thread, tested all the version again and none is working 🙄

Link to comment
  • 2 weeks later...
On 3/5/2024 at 3:29 PM, artyp said:

The code is from this thread, tested all the version again and none is working 🙄

This is tested against your site and it works
 

<script>
// Wait for the DOM content to be fully 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('[data-test="gallery-reel-control-btn-next"]');

    // Set auto-scrolling for each carousel
    nextArrows.forEach(function(arrow) {
        var intervalId; // Variable to hold the interval ID

        // Define a function to handle auto-scrolling for a specific carousel
        function autoScroll() {
            clickNext(arrow);
        }

        // Start the auto-scrolling for the current carousel
        intervalId = setInterval(autoScroll, 4000);

        // Stop autoplay when the arrow is clicked
        arrow.addEventListener("click", function(e) {
			// Stop autoplay when it is user-triggered event
            if (e.offsetX || e.offsetY) {
                clearInterval(intervalId);
            }
        });
    });
};
</script>

Place it in your Footer injection

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget 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

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.