画像のスライドはうまくいっているのにも関わらずcurrentslideの部分がプラスされていきません。どこが原因でしょうか?
html
1<div class="footer_logo_bar_bg "> 2 <p class="footer_logo_bar_bg_prev " onclick="footer_prev() "><img src="img/btn_prev_01.png "></p> 3 <div class="footer_slider "> 4 <ul id="footer_slides " class="footer_slides "> 5 <li class="footer_slide "><img src="img/bnr_footer_01.png "></li> 6 <li class="footer_slide "><img src="img/bnr_footer_02.png "></li> 7 <li class="footer_slide "><img src="img/bnr_footer_04.png "></li> 8 <li class="footer_slide "><img src="img/bnr_footer_05.png "></li> 9 <li class="footer_slide "><img src="img/bnr_footer_06.png "></li> 10 <li class="footer_slide "><img src="img/bnr_footer_07.png "></li> 11 <li class="footer_slide "><img src="img/bnr_footer_08.png "></li> 12 <li class="footer_slide "><img src="img/bnr_footer_09.png "></li> 13 <li class="footer_slide "><img src="img/bnr_footer_10.png "></li> 14 <li class="footer_slide "><img src="img/bnr_footer_11.png "></li> 15 <li class="footer_slide "><img src="img/bnr_footer_01.png "></li> 16 </ul> 17 </div> 18 <p class="footer_logo_bar_bg_next " onclick="footer_next() "><img class="footer_logo_bar_bg_next " src="img/btn_next_01.png "></p> 19 </div>
CSS
1.footer_slider { 2 width: 60vw; 3 overflow: hidden; 4 margin-top: 20px; 5 } 6 7 .footer_slides { 8 width: 165vw; 9 overflow: hidden; 10 } 11 12 .footer_slide { 13 float: left; 14 padding: 0 5px; 15 width: 15vw; 16 }
js
1var $footer_slides = $(".footer_slides"); 2 var currentslide = 1; 3 var slideCount = 8; 4 var footer_slidetime = 3000; 5 var animationtime = 1000; 6 7 // 横移動のスライドショー 8 setInterval(function() { 9 $footer_slides.animate({ 10 'marginLeft': '-=15vw' 11 }, animationtime, function() { 12 currentslide++; 13 if (currentslide === slideCount) { 14 currentslide = 1; 15 $(this).css("margin-left ", "0vw "); 16 } 17 }); 18 }, footer_slidetime); 19 20 console.log(currentslide);
回答2件
あなたの回答
tips
プレビュー