javascript - Stop Animation on Bootstrap Carousel starting over again when slide -
i've image slider simple animation when text appear. however, animation starts again when image slide. got idea? set animation 'forwards'.
here's jsfiddle https://jsfiddle.net/w3nta1/9vnz3bg1/1/
<div id="mycarousel" class="carousel fdi-carousel slide"> <!-- carousel items --> <div class="carousel fdi-carousel slide" id="eventcarousel" data-interval="0"> <div class="carousel-inner onebyone-carosel"> <div class="item active"> <div class="col-xs-4"> <a href="#"><figure> <figcaption class="imageappear1">1</figcaption> <img src="http://www.corincloud.com/skin/1100/img/example-200x200.gif" class="img-responsive center-block"> </figure></a> </div> </div> <div class="item"> <div class="col-xs-4"> <a href="#"><figure class="cap-left"> <figcaption class="imageappear2">2</figcaption> <img src="http://www.corincloud.com/skin/1100/img/example-200x200.gif" class="img-responsive center-block"> </figure></a> </div> </div> <div class="item"> <div class="col-xs-4"> <a href="#"><figure class="cap-left"> <figcaption class="imageappear3">3</figcaption> <img src="http://www.corincloud.com/skin/1100/img/example-200x200.gif" class="img-responsive center-block"> </figure></a> </div> </div> <div class="item"> <div class="col-xs-4"> <a href="#"><figure class="cap-left"> <figcaption class="imageappear3">4</figcaption> <img src="http://www.corincloud.com/skin/1100/img/example-200x200.gif" class="img-responsive center-block"> </figure></a> </div> </div> <div class="item"> <div class="col-xs-4"> <a href="#" class="imageappear3"><figure class="cap-left"> <figcaption>5</figcaption> <img src="http://www.corincloud.com/skin/1100/img/example-200x200.gif" class="img-responsive center-block"> </figure></a> </div> </div> </div> <a class="left carousel-control" href="#mycarousel" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">previous</span></a> <a class="right carousel-control" href="#mycarousel" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">next</span> </a></div></div>
here's css:
.carousel-inner.onebyone-carosel { margin: auto; width: 76%; } .onebyone-carosel .active.left { left: -33.33%; } .onebyone-carosel .active.right { left: 33.33%; } .onebyone-carosel .next { left: 33.33%; } .onebyone-carosel .prev { left: -33.33%; } figure { display: block; position: relative; overflow: hidden; margin: 0; } figcaption { position: absolute; bottom: 0; background: rgba(0,0,0,0.7); color: #f47a20; text-align: center; font-size: 16px; font-weight: bold; padding: 18px 20px; opacity: 0; height: 80px; width: 100%;} .imageappear1 { -webkit-animation: appearbottom 1s ease-in-out 1s forwards; -moz-animation: appearbottom 1s ease-in-out 1s forwards; -o-animation: appearbottom 1s ease-in-out 1s forwards; animation: appearbottom 1s ease-in-out 1s forwards;} .imageappear2 { -webkit-animation: appearbottom 1s ease-in-out 2s forwards; -moz-animation: appearbottom 1s ease-in-out 2s forwards; -o-animation: appearbottom 1s ease-in-out 2s forwards; animation: appearbottom 1s ease-in-out 2s forwards;} .imageappear3 { -webkit-animation: appearbottom 1s ease-in-out 3s forwards; -moz-animation: appearbottom 1s ease-in-out 3s forwards; -o-animation: appearbottom 1s ease-in-out 3s forwards; animation: appearbottom 1s ease-in-out 3s forwards;} @-webkit-keyframes appearbottom { 0% { opacity: 0; margin-bottom: -80px; } 100% { opacity: 1; margin-bottom:0; }} @-moz-keyframes appearbottom { 0% { opacity: 0; margin-bottom: -80px; } 100% { opacity: 1; margin-bottom:0; }}
whenever slider slide, animation starts on again. idea stop animation?
wiki
Comments
Post a Comment