Jump to content

Summary Block: How can I set the Carousel to "autoplay"?

Go to solution Solved by clayyount,

Recommended Posts

For some reason this solution (the original approved solution) has stopped working... has anyone else experienced this?

We are using the Brine template. It may have happened after the most current Squarespace update because all was working fine for the past several months.

Edited by tb1200
Initial Revision
Link to comment
  • 4 weeks later...

@tb1200 I was thinking the same. I realized that we had successfully implemented this in the past with another page on our site, but that it had stopped working. Wasn't sure when.

@WTCOC Any ideas on how to get this working again?

Link to comment
  • 1 month later...
  • 2 months later...

--I'm not a coder-- but I mixed code from a couple of answers and got this to work in the updated 2019 SS. Note: It does not work in the preview and you have to view your site from an incognito window (aka signed out of the backend to see it). PLUS you need to add this to the page header code injection section. If the page is in an Index, you need to add it to the Index's header code injection.


<script>
    Y.on('domready', function () {
        var galleries = Y.Squarespace.GalleryManager.getGalleries();
        for( i = 0; i < galleries.length; i++){
            galleries[i].setAttrs({
              "autoplay": true,
              "autoplayOptions": {
          "timeout":10000,
          "randomize": true
              }
            })
        }
    });
</script>





Edited by LJSpace
Initial Revision
Link to comment
Guest eugeneoei

so.... i tried all suggested solutions and nothing seemed to work for the past 3 hours.

the most recent suggested solution by @LJSpace did not work for me either.

the value

galleries

returned is just weird. It returns an empty

array

and yet there are some

t

weird-object-looking thing (you should know what i mean if you're a developer).

i started investigating the

Y.Squarespace

object in the console and thank god i found a solution!

just paste the following into the code injection. im on squarespace 7 and using the Bryant theme.


<script>
   Y.on('domready', function () {
       Y.Squarespace.Gallery2.ATTRS.autoplay.value = true
   })
</script>

hope it helps the next person who reads this!

Edited by eugeneoei
Link to comment
  • 4 weeks later...
  • 4 weeks later...

@eugeneoei

Strange, maybe try again, I think SquareSpace made some updates. I also started using a different code for this, which I found in an earlier post since I wanted to target a specific gallery. Remember to add this to the page header code injection OR the header code injection for the Index if it's in an Index. Also it may not work in preview. Try testing it from an incognito window in your browser.

 

<script>  
 Y.on('domready', function () {
   try {
     var container = Y.one("#reviews"); /*change this to the slug of your page*/
     var gallery = Y.Squarespace.GalleryManager.getGalleryByContainer(container);
     gallery.setAttrs({
       "autoplay":true,
       "autoplayOptions": {
         "timeout":9000, /*make this higher to decrease speed, lower to increase it*/
         "randomize": true
       }
     });
   } catch (e) {
     console.error("Could not configure Gallery autoplay.", e);
   }
 });
</script>

 

Link to comment
  • 1 month later...

Great, I got this working on my index (Brine). Thanks everyone for the collaborative effort.

For any noobs (like me) the slug replacement would be ("#pagename") - which is the page name you're sourcing your testimonials from, which in my case was called Testimonials

 

Two questions - as this code injection stuff is kind of another coding format to the Design CSS... how can we add easing to this? It's linear animation could be tweaked to be more pleasing. And how do we remove the arrows? (as they are no longer needed in my case)

Edited by JonJonJon
Link to comment

Moving the arrows

I decided to leave the arrows in, because as mentioned the autoplay only works on the first interaction with the carousel.

This code I got from: https://thirtyeightvisuals.com/blog/custom-arrows-testimonial-carousel-squarespace

Which also outlines more customisations to the carousel should you wish

/////TESTIMONIALS ARROWS///

.summary-carousel-pager {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100% !important;
  z-index: 1;
}

.sqs-gallery-design-carousel .sqs-gallery-controls .previous {
  float: left;
}
.sqs-gallery-design-carousel .sqs-gallery-controls .previous,
.sqs-gallery-design-carousel .sqs-gallery-controls .next {
  margin:0;
}

 

Link to comment
  • 2 months later...
  • 2 months later...
On 4/28/2018 at 7:17 AM, Andrei said:

In case someone wants to customize a specific gallery, you can find it by section name. You can make a section with a slug, for example: "home-testimonials". Then, find the gallery that resides inside this container.

Example:



 

<script>  
 Y.on('domready', function () {
   try {
     var container = Y.one("#home-testimonials");
     var gallery = Y.Squarespace.GalleryManager.getGalleryByContainer(container);
     gallery.setAttrs({
       "autoplay":true,
       "autoplayOptions": {
         "timeout":20000,
         "randomize": true
       }
     });
   } catch (e) {
     console.error("Could not configure Gallery autoplay.", e);
   }
 });
</script>




 

 

Hi, I'm trying to add an autorotating carousel to the bottom of this index page: https://brynbonino.com/.  I've tried several variations of code on this page. This seems to be the most recent answer. Can you help me out? I can't seem to get it to work. I've copied the above to the header of the page in the index that the carousel is in.  Am I doing anything wrong?

Link to comment
  • 2 weeks later...
On 1/9/2020 at 11:04 PM, shayshaf said:

Hi guys, 

Is this still working? I've been trying to make it work for hours and nothing works.
Please help!
Thank you

 

8 hours ago, dearnaomichan said:

I'm curious if anyone has tried this in 7.1? It's not working for me and the error I'm getting is "Y is not defined"? Any help is greatly appreciated! 

 

On 5/27/2020 at 9:42 AM, Bryn said:

Hi, I'm trying to add an autorotating carousel to the bottom of this index page: https://brynbonino.com/.  I've tried several variations of code on this page. This seems to be the most recent answer. Can you help me out? I can't seem to get it to work. I've copied the above to the header of the page in the index that the carousel is in.  Am I doing anything wrong?

Add to Home > Settings > Advanced > Code Injection > Footer

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
  $(document).ready(function() {
    try {
     var container = Y.one("#page-section-5eb02bfe70ac761fe73cbc71"); /*change this to the slug of your page*/
     var gallery = Y.Squarespace.GalleryManager.getGalleryByContainer(container);
     gallery.setAttrs({
       "autoplay":true,
       "autoplayOptions": {
         "timeout":1000, /*make this higher to decrease speed, lower to increase it*/
         "randomize": true
       }
     });
   } catch (e) {
     console.error("Could not configure Gallery autoplay.", e);
   }
});
</script>

 

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
  • 4 weeks later...
On 6/9/2020 at 3:01 AM, tuanphan said:

 

 

Add to Home > Settings > Advanced > Code Injection > Footer


<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
  $(document).ready(function() {
    try {
     var container = Y.one("#page-section-5eb02bfe70ac761fe73cbc71"); /*change this to the slug of your page*/
     var gallery = Y.Squarespace.GalleryManager.getGalleryByContainer(container);
     gallery.setAttrs({
       "autoplay":true,
       "autoplayOptions": {
         "timeout":1000, /*make this higher to decrease speed, lower to increase it*/
         "randomize": true
       }
     });
   } catch (e) {
     console.error("Could not configure Gallery autoplay.", e);
   }
});
</script>

 

is there a way to make the summary carousel loop/repeat items when you get to the end but not autoplay?

Link to comment

I'm another person trying to get a Reel slideshow to autoplay in 7.1. I've seen a few answers floating around, but none seem to be working for me. Have folks confirmed that the code above shared by @Andrei and @tuanphan makes autoplay work for slideshow blocks in 7.1? If yes, I'm seeing people post that it works either when injected in the footer of the whole site or under advanced settings for a particular page — which is working? 

And maybe I'm completely missing something here, but should the slug added to target your gallery be your page ID (e.g. collection ID found in body tag) or section id for the gallery itself? 🙃

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.