Skip to main content

The Search for a Better Slider - Option 1

  • June 2, 2022
  • 87 replies
  • 3635 views

Show first post

87 replies

cailync
Novice II
Forum|alt.badge.img
  • Novice II
  • September 18, 2025

@gstager Thank you for providing these helpful instructions for the rotating banner! I have been redesigning the homepage of our LMS and adding this banner really brought it to life. 

I am running into some trouble with the CSS for it though. We only have two images in the rotating banner currently (I repeated the first banner at the end though to make it 3 images). I could not figure out the CSS, it would end up putting two banners on top of each other, rather than one after the other. So, I actually repeated both the first and second banners so that the carousel goes through image 1, image 2, image 1, image 2. But after the second time around, there is a blank before it goes back to the start of the rotation. Any ideas on how to get rid of that blank at the end of the 4 total images? 


gstager
Hero III
Forum|alt.badge.img+8
  • Author
  • Hero III
  • September 18, 2025

@cailync - if you’re able to share what you are using for HTML and CSS - it might be easier to discover the cause of the issue.


cailync
Novice II
Forum|alt.badge.img
  • Novice II
  • September 18, 2025

@gstager Sure thing! The CSS is the same as what you provided in this post. 

HTML: 

<div id="bannerSlider">
<figure class="slider">
<figure>
            <img src="https://cdn5.dcbstatic.com/files/f/r/freedommortgage_university_docebosaas_com/userfiles/13254/use_freedom_focus_intro_banner.jpg" alt="use_freedom_focus_intro_banner.jpg" />
</figure>
<figure>
<a href="https://www.freedommortgage.com/learning-center/articles/mortgage-rates-change" target="_blank" rel="noreferrer noopener">
 
            <img src="https://cdn5.dcbstatic.com/files/f/r/freedommortgage_university_docebosaas_com/userfiles/13254/use_freedom_focus_article_banner__1_.jpg" alt="use_freedom_focus_article_banner__1_.jpg" /></a>
</figure>
<figure>
            <img src="https://cdn5.dcbstatic.com/files/f/r/freedommortgage_university_docebosaas_com/userfiles/13254/use_freedom_focus_intro_banner.jpg" alt="use_freedom_focus_intro_banner.jpg" />
</figure>
<figure>
<a href="https://www.freedommortgage.com/learning-center/articles/mortgage-rates-change" target="_blank" rel="noreferrer noopener">
            <img src="https://cdn5.dcbstatic.com/files/f/r/freedommortgage_university_docebosaas_com/userfiles/13254/use_freedom_focus_article_banner__1_.jpg" alt="use_freedom_focus_article_banner__1_.jpg" /></a>
</figure>
</figure></div>


gstager
Hero III
Forum|alt.badge.img+8
  • Author
  • Hero III
  • September 18, 2025

There are actually a few versions of the CSS in this thread - including a couple of posts about how to accommodate for three images.


Bkatzman
Influencer III
Forum|alt.badge.img+1
  • Influencer III
  • September 19, 2025

@Bkatzman - glad to hear you are liking the slider.

You may be running into an issue similar to the last couple posts above this one.

Try tweaking the percentage a little to see how that responds as that seemed to help in that case.

Sounds like the issue comes into play with WYSIWYG versus direct link images.

Once that lines up - perhaps the scroll bar will go away as well.

Thanks for all of your help ​@gstager I am so close to being done with this project!

I am still struggling with drift despite messing with the 20%. I have five images (the 1st and 5th are the same). After the first image passes, the images are slightly drifting to the right, revealing a little white space, and the tail end of the previous image.

I am using the exact CSS and HTML code and all of the images are 1200x280. I am not using the WYSIWYG. 

Any help would be greatly appreciated. I’m so very close thanks to your guidance. I really appreciate it!

 


gstager
Hero III
Forum|alt.badge.img+8
  • Author
  • Hero III
  • September 19, 2025

@cailync - ​@Bkatzman 

Let’s try the following adjustments to the CSS code.

  1. Find the figure.slider selector
figure.slider { 
position: relative;
width: 500%;
animation-name: slide;
animation-duration: 30s;
animation-iteration-count: infinite;
display: flex; /** Add this **/
}
  1. Find the figure.slider figure selector
figure.slider figure { 
width: 20%;
height: auto;
/** Remove display: inline-block **/
/** Remove position: inherit **/
flex-shrink: 0; /** Add this **/
}

Let me know how this goes.


Bkatzman
Influencer III
Forum|alt.badge.img+1
  • Influencer III
  • September 19, 2025

@cailync - ​@Bkatzman 

Let’s try the following adjustments to the CSS code.

  1. Find the figure.slider selector
figure.slider { 
position: relative;
width: 500%;
animation-name: slide;
animation-duration: 30s;
animation-iteration-count: infinite;
display: flex; /** Add this **/
}
  1. Find the figure.slider figure selector
figure.slider figure { 
width: 20%;
height: auto;
/** Remove display: inline-block **/
/** Remove position: inherit **/
flex-shrink: 0; /** Add this **/
}

Let me know how this goes.

Hi ​@gstager ! Thanks for the updated code.

The good news is that it took care of the drift.

The only negative side-effect is that after the final image (image 4) it quickly “slides” through a blank image


gstager
Hero III
Forum|alt.badge.img+8
  • Author
  • Hero III
  • September 19, 2025

The only negative side-effect is that after the final image (image 4) it quickly “slides” through a blank image

 

I believe this means your number of slides in HTML does not line up with the timing component in the CSS.

For example - try simply adding an additional image to the slider.

Keep the first and last the same.

CSS must be modified if you change the number of images.


Bkatzman
Influencer III
Forum|alt.badge.img+1
  • Influencer III
  • September 19, 2025

The only negative side-effect is that after the final image (image 4) it quickly “slides” through a blank image

 

I believe this means your number of slides in HTML does not line up with the timing component in the CSS.

For example - try simply adding an additional image to the slider.

Keep the first and last the same.

CSS must be modified if you change the number of images.

Thanks again ​@gstager I added a fifth image. Now it speeds up through this fifth image, which “slides” very quickly and only appears for a second or two, before displaying the first image. 

Appreciate your help with us. I am completely out of my element with this topic.


gstager
Hero III
Forum|alt.badge.img+8
  • Author
  • Hero III
  • September 19, 2025

This thread has been extremely popular and there are many questions about modification for multiple different pictures. That has meant a lot of things getting mixed up.

I am going to make a series of new slider postings - one for each option of two image slider, three image slider, four image slider, and five image slider.

Each post will have its own HTML and CSS to refer to.

I hope this will make things easier for others going forward.

I will start posting them shortly so you can choose your number of images slider and go from there with fresh HTML and CSS


gstager
Hero III
Forum|alt.badge.img+8
  • Author
  • Hero III
  • September 19, 2025

For those coming here - thanks for your interest in the image slider.

I have created four separate postings depending on the number of pictures you have in your slider.

I can create more if necessary. Please visit one of the links below for your particular case.

 

 

Hopefully these make things at least a little easier for everyone.


Bkatzman
Influencer III
Forum|alt.badge.img+1
  • Influencer III
  • September 26, 2025

@gstager I can’t thank you enough! After some trial and error, I got it to work! I greatly appreciate the time and effort you put into this!