html - CSS Image Slider not working after adding 6 photos -
i using responsive css image slider from: https://codepen.io/dudleystorey/pen/ehkpi
it worked fine when used 2, 4, or 5 pics. however, when tried using 6 photos first , last photo stack together, last slide blank, , slides between have white space under them.
the following css code after revised it:
@keyframes slidy{ 0% { left: 0%; } 9.09% { left: 0%; } 18.18% { left: -100%; } 27.27% { left: -100%; } 36.36% { left: -200%; } 45.45% { left: -200%; } 54.54% { left: -300%; } 63.63% { left: -300%; } 72.72% { left: -400%; } 81.81% { left: -400%; } 90.90% { left: -500%; } 100% { left: -500%; } } .slide { margin: 0 auto ; max-width: 700px; overflow: hidden; border-style: solid; border-width: 5px; border-color: #f6a51c; } .slide figure { position: relative; width: 500%; margin: 0 auto; animation: 30s slidy infinite; } .slide figure img { width: 20%; float: left; }
the following html code after revised it:
<div class="slide"> <figure> <img src="http://inmodemd.com/images/bodyfx-ba1.jpg" alt="" /> <img src="http://inmodemd.com/images/bodyfx-ba2.jpg" alt="" /> <img src="http://inmodemd.com/images/bodyfx-ba3.jpg" alt="" /> <img src="http://inmodemd.com/images/bodyfx-ba4.jpg" alt="" /> <img src="http://inmodemd.com/images/bodyfx-ba5.jpg" alt="" /> <img src="http://inmodemd.com/images/bodyfx-ba6.jpg" alt="" /> </figure> </div>
your image 20%, total width max 700 , trying squeeze percentage. 5 max because each image 20% of 100% width. 20 x 5 100. 6 / 100 = 16.66666 , means images wont fit 100% across. nice slider though. hope helps.
Comments
Post a Comment