Cấu trúc một carousel:
- <span class="nt"><div class="col-md-6 col-md-offset-3">
- <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
- <!-- Indicators -->
- <ol class="carousel-indicators">
- <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
- <li data-target="#carousel-example-generic" data-slide-to="1"></li>
- <li data-target="#carousel-example-generic" data-slide-to="2"></li>
- <li data-target="#carousel-example-generic" data-slide-to="3"></li>
- </ol>
- <!-- Wrapper for slides -->
- <div class="carousel-inner">
- <div class="item active">
- <img src="http://placehold.it/500/e499e4/fff&text=1">
- <div class="carousel-caption">
- caption 1
- </div>
- </div>
- <div class="item">
- <img src="http://placehold.it/500/e499e4/fff&text=2">
- <div class="carousel-caption">
- caption 2
- </div>
- </div>
- <div class="item">
- <img src="http://placehold.it/500/e499e4/fff&text=3">
- <div class="carousel-caption">
- caption 3
- </div>
- </div>
- <div class="item">
- <img src="http://placehold.it/500/e499e4/fff&text=4">
- <div class="carousel-caption">
- <h1>Caption 4</h1>
- <p>content </p>
- </div>
- </div>
- </div>
- <!-- Controls -->
- <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
- <span class="glyphicon glyphicon-chevron-left"></span>
- </a>
- <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
- <span class="glyphicon glyphicon-chevron-right"></span>
- </a>
- </div>
- </div></span>
- .carousel-inner img{
- width:100%;
- }
- .carousel-inner .item{
- transition:opacity 0.4s ease-in-out ;
- -webkit-transition:opacity 0.4s ease-in-out;
- -ms-transition:opacity 0.4s ease-in-out;
- }
- .carousel-inner .active.left,.carousel-inner .active.right{
- left:0;
- opacity:0.3;
- }
- .carousel-inner .next,.carousel-inner .prev {
- opacity:0.5;
- }
- .item h1{{position:absolute;top:150px;text-align:center;width:100%;transition:all ease-in-out 0.2s;opacity:0}
- .item p{position:absolute;top:200px;text-align:center;width:100%;transition:all ease-in-out 0.4s;opacity:0}
- .item.active h1, .item.activep{opacity:1}
- .item.active h1{animation: run 0.2s ease-in-out ;}
- .active.item{
- animation-delay:0.4s;
- run 0.2s ease-in-out}
- @keyframes run{
- 0%{opacity:0;transform:scale(0.3);}
- @media all and (transform-3d), (-webkit-transform-3d) {
- .carousel-fade .carousel-inner > .item.next,
- .carousel-fade .carousel-inner > .item.active.right {
- opacity: 0;
- -webkit-transform: translate3d(0, 0, 0);
- transform: translate3d(0, 0, 0);
- }
- .carousel-fade .carousel-inner > .item.prev,
- .carousel-fade .carousel-inner > .item.active.left {
- opacity: 0;
- -webkit-transform: translate3d(0, 0, 0);
- transform: translate3d(0, 0, 0);
- }
- .carousel-fade .carousel-inner > .item.next.left,
- .carousel-fade .carousel-inner > .item.prev.right,
- .carousel-fade .carousel-inner > .item.active {
- opacity: 1;
- -webkit-transform: translate3d(0, 0, 0);
- transform: translate3d(0, 0, 0);
- }
- }
- }
Không có nhận xét nào:
Đăng nhận xét