Jump to content

Auto slideshow with text and button reposition for mobile

Recommended Posts

Hello,

I'm having a issue for my auto slideshow reel for mobile version. It works fine on website with text and button, but when it turns to mobile, images are too big and goes overlay with text and button. I wish it goes like the reference photo, smaller image size, text and button on the bottom with background block. How can I fix this? FYI, here's the code that I used to make auto slideshow banner 

<script>
  (function(){
    let playInBackend = true,
        timing = 6,
        section = '',
        direction = 1;

function AutoScrollLayout(e){e=""==e?document.querySelector(".user-items-list-section"):document.querySelector(e);let t,n,o,i,c,r=!1,s=e.querySelectorAll('button[class*="__arrow-button"]');function d(){t=setInterval(u,n)}function u(){o=document.querySelector("body.sqs-edit-mode-active"),i=document.querySelector(".sqs-modal-lightbox-open"),r||o||i||!c||s[direction].click()}n=1e3*timing;if(document.addEventListener("visibilitychange",function(){r=!!document.hidden}),["mousedown","touchstart"].forEach(t=>{e.addEventListener(t,function(){r=!0})}),["mouseup","touchend"].forEach(n=>{e.addEventListener(n,function(){r=!1,clearInterval(t),d()})}),window.IntersectionObserver){new IntersectionObserver((e,t)=>{e.forEach(e=>{c=!!e.isIntersecting})},{rootMargin:"-75px 0px -75px 0px"}).observe(e)}s[direction]&&d()}window.addEventListener("load",function(){let e=new Array;e.push(section),section.includes(",")&&(e=section.split(",")),e.forEach(e=>{(window.top==window.self||window.top!==window.self&&playInBackend)&&new AutoScrollLayout(e)})});
  }());
</script>


https://www.nine.education/ Link for the website
image.thumb.png.1be0413966e0a5df1dbcac18b10a2e74.png

Screenshot 2023-12-08 at 2.17.07 PM.png

Screenshot 2023-12-08 at 2.20.52 PM.png

Link to comment
  • Replies 6
  • Views 1.5k
  • Created
  • Last Reply

Top Posters In This Topic

Add this code to Website Tools (under Not Linked) > Custom CSS

/* List Slideshow - Stacked on Mobile */
@media screen and (max-width:767px) {
.user-items-list-item-container[data-section-id="654fd0b1340d6e12c50b12d6"] {
li.slide.list-item>div {
    position: static !important;
}
li.slide.list-item {
    flex-direction: column;
    padding: 0 !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

Thanks for the solution! I implemented the code you provided, and now it works better than before but it still got problems like the screenshoot I attached below.
This is out of my first question, how can I make this header slide like this reference New Balance homepage banner? It shows only right halt of the image in its mobile version. This way, I think my website won't show unnecessary empty space on mobile version.

Thank you advance!
 

Screenshot 2023-12-12 at 6.21.19 PM.png

Screenshot 2023-12-12 at 6.22.13 PM.png

Screenshot 2023-12-12 at 6.22.25 PM.png

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.