Jump to content

Scrolling Carousel for Clients showcase

Go to solution Solved by tuanphan,

Recommended Posts

Hi,

I've seen a few forum requests for auto scrolling carousels for clients. I cant seem to get any of the code in these requests to work.
1. Is there a way to  smooth scroll the clients logo on autoplay without paying for a plugin? have i picked the wrong gallery for the client icons? is there a squarespace auto scrolling gallery i can use?
kind of like this plugin: https://schwartz-edmisten.com/shop/animated-scrolling-logos

scroll.thumb.jpg.3fdc738dedf84c976d6be8d97abe8803.jpg
 

2. on mobile the gallery  goes to 1 item is there a way it can be 3?
before:
image.thumb.jpeg.eed561da26935b140650847e5269c1ac.jpeg

after:
image.thumb.jpeg.f566fe0c555ec8b334382c23caf0e25a.jpeg

web:https://ellipse-teal-dl5w.squarespace.com/
password:2

thanks again
 

Link to comment
  • Solution

#1. First enable Carousel Arrows then use this code to Website > Website Tools > Code Injection > Footer (The code will make arrows invisible then)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>

  $( ( ) => {
  
    /*
    
      auto click user items list arrow right
      
      Version       : 0.1d0
      
      SS Version    : 7.1
      
      Dependancies  : jQuery
      
      Note          : this effect is not active in SS Preview to test it use
                      private browsing < https://bit.ly/3f6lhq2 >.
      
      By            : Thomas Creedon < http://www.tomsWeb.consulting/ >
      
      */
      
    const clickIntervalSeconds = 2;
    
    const dataSectionIds = [
    
      /*
      
        to limit the effect to certain page sections, enter data section ids for
        each page section.
        
        the format of each line is a data section id
        
        following is an example line. copy the example line below and paste
        after the example line. remove '// ' at beginning of pasted line. repeat
        for as many data sections ids as needed
        
        */
        
      // '[enter data section id here between single quotes]',
      
      ];
      
    // do not change anything below, there be the borg here
    
    if ( window.frameElement !== null ) return; // bail if in Preview
    
    let selector = [
    
      '.user-items-list-banner-slideshow__arrow-button--right',
      
      '.user-items-list-carousel__arrow-button--right',
      
      ];
      
    // begin shotgun selector
    
      if ( ! dataSectionIds.length ) dataSectionIds.push ( '' );
      
      selector = $.map ( selector, function ( s, i ) {
      
        if ( ! dataSectionIds.length ) dataSectionIds.push ( '' );
        
        const a = $.map ( dataSectionIds, function ( d, i ) {
        
          if ( d ) d = '[data-section-id="' + d + '"] ';
          
          return d + s;
          
          } )
          
        return a;
        
        } )
        
        .join ( ', ' );
        
      // end shotgun selector
    
    const $button = $( selector );
    
    if ( ! $button.length ) return; // bail if no button
    
    const click = ( ) => {
    
      $button.click ( );
      
      }
      
    setInterval ( click, clickIntervalSeconds * 1000 );
    
    } );
    
  </script>
 <style>
.user-items-list-item-container[data-section-id="64e0f5e72187090abf355723"] .desktop-arrows, .user-items-list-item-container[data-section-id="64e0f5e72187090abf355723"] .mobile-arrows {
    display: none !important;
}
</style>

#2. Add to Website Tools > Custom CSS

@media screen and (max-width:767px) {
.user-items-list-item-container[data-section-id="64e0f5e72187090abf355723"] ul {
    grid-template-columns: repeat(2,1fr) !important;
}
}

 

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

works great! appreciate the time.
I'm guessing the carousel is limited to the stop/start jaggered movement because its hitting the arrow button every 2 seconds and not giving a smooth right to left animation scroll continuously.

*I was hoping since you can mouse click holddown and drag a smooth animation from left to right with your mouse maybe some code code mimic this mouse drag.

the plugin is a smooth animation and not a stop start.
https://schwartz-edmisten.com/shop/animated-scrolling-logos

since im happy with the look of it so far i guess i could pay for the plugin, but any advice?

Link to comment
2 hours ago, MAC1 said:

works great! appreciate the time.
I'm guessing the carousel is limited to the stop/start jaggered movement because its hitting the arrow button every 2 seconds and not giving a smooth right to left animation scroll continuously.

*I was hoping since you can mouse click holddown and drag a smooth animation from left to right with your mouse maybe some code code mimic this mouse drag.

the plugin is a smooth animation and not a stop start.
https://schwartz-edmisten.com/shop/animated-scrolling-logos

since im happy with the look of it so far i guess i could pay for the plugin, but any advice?

#1. Use this new code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(() => {
    setTimeout(() => {
        const items = $('.user-items-list-item-container[data-section-id="64e0f5e72187090abf355723"] li.user-items-list-carousel__slide.list-item')
        const x = parseInt($(items[1]).css('transform').split(', ')[4]);
        const all = x * (items.length - 1)
        setInterval(() => {
            for(let i=0; i<items.length; i++) {
                let curX = parseInt($(items[i]).css('transform').split(', ')[4]);
                if (curX === -9999) curX = i*x;
                console.log(curX)
                if (curX === -x - 30) curX = (items.length - 1) * x - 30;
                else curX = curX - 1;
                const old = $(items[2]).css('transform').split(', ')
                old[4] = JSON.stringify(curX)
                $(items[i]).css('transform', old.join(', '))
            }
            
        }, 20);
    }, 1000);
    
})
</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

thats simply amazing. the logos are moving nice and smooth looks great.

2 issues have arisen out of the new code though.
1. on resize or manual scroll  some logos get cropped and overlap other ones in front as seen in screenshot
 

helpagain.thumb.jpg.a0e8f930f7b45471f7a898c72365a666.jpg

2. the side arrows need to disappear again like in the old code

thanks for the support i haven't been able to find this kind of solution anywhere so grateful for achieving this result so far. 
thanks so much

Link to comment

ok i got the side arrows to disappear with this code in code injection footer:
now all i need is a solution to the code so the client icons doesn't overlap and cutup/mask each other when it scrolls manually 

 <style>
.user-items-list-item-container[data-section-id="64e0f5e72187090abf355723"] .desktop-arrows, .user-items-list-item-container[data-section-id="64e0f5e72187090abf355723"] .mobile-arrows {
    display: none !important;
}
</style>
Link to comment
21 hours ago, MAC1 said:

ok i got the side arrows to disappear with this code in code injection footer:
now all i need is a solution to the code so the client icons doesn't overlap and cutup/mask each other when it scrolls manually 

 <style>
.user-items-list-item-container[data-section-id="64e0f5e72187090abf355723"] .desktop-arrows, .user-items-list-item-container[data-section-id="64e0f5e72187090abf355723"] .mobile-arrows {
    display: none !important;
}
</style>

It is fine to me. See video

https://www.loom.com/share/cf9567232c1b425e90020e276b9a1a28

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
On 8/21/2023 at 7:10 PM, MAC1 said:

Hi,
Looks great when its like that but as soon as you either
resize the window or manually scroll across the clients this happens:

ive made a quick video where the mouse pointer shows the issue

https://vimeo.com/856386618/ef2f4dc16a?share=copy

Hope theres a fix, thanks

If you reload the page, the problem will go away. Usually the <script> code will not automatically reload when you resize the browser.

It also means that if you resize the browser to a specific screen sizes, the code will not run properly (but if you access a real device with that screen sizes, the code will run)

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

The user looking at the website is not going to know to reload that though.
It looks broken, almost like there is 2 carousels running on top of each other at different speeds, also sometimes the logos will disappear before it reaches the left side. it might be too much to solve with scripting?

I think the plugin might be the safest option? do you have a preference?

thanks for your time on this


 

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.