[英]bootstrap carousel next and previous images not displaying
im working on bootstrap carousel which displaying images from database.Now i need to use this to display next and previous images as well in the same container.carousel is working fine but its not displaying next and prev images in it i tried This . 我正在处理引导轮播,该轮播显示来自数据库的图像。现在,我需要使用它来在同一容器中显示下一个和上一个图像。轮播工作正常,但它不显示下一个和上一个图像,所以我尝试了这个 。 But getting Image as given below. 但是获得图像如下。 Thank you for answer. 谢谢你的答案。
Output image is given. 给出输出图像。 Output im getting 输出即时
$(document).ready(function(){ $scope.vehicleImageList = {}; $http.get('http://localhost:8087/mmg/api/v1/franchisevehicleimages/'+$scope.source, { headers: { XXXXXXXXXXXXXXXXx } }).then(function (results2) { $scope.vehicleImageList = results2.data.data; }); $(function(){ $('.carousel-control').click(function(e){ e.preventDefault(); $('#myCarousel').carousel( $(this).data() ); }); }) });
.carousel, .carousel-inner, .carousel-inner > .item { overflow: hidden; } .carousel-inner:before { position:absolute; top:0; bottom: 0; right: 82%; left: 0; content:""; display:block; background-color: #fff; z-index: 2; } .carousel-inner:after { position:absolute; top:0; bottom:0; right: 0; left: 82%; content:""; display:block; background-color:#fff; z-index: 2; } .carousel-control.left, .carousel-control.right { background: initial; width: 30%; color: #000; z-index: 10; top: -10px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!-- image carousel --> <div class="row"> <div class="item form-group"> <div class="col-md-11"> <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false"> <!-- Wrapper for slides --> <div class="carousel-inner"> <div class="item" ng-class="{active:!$index}" ng-repeat="list in vehicleImageList | unique:'name'"> <img src="./src/images/{{list.name}}" alt="Vehicle" style="height:150px;width:250px"> <!-- <div class="carousel-caption" style="color:black"> <h3 class="h3-responsive">Light mask</h3> <p>First text</p> </div> --> </div> <!-- Left and right controls --> <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> </div> </div> </div>
It easily can do using bootstrap. 使用引导程序很容易做到。
see following code: 请参阅以下代码:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Carousel Example</h2>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="la.jpg" alt="Los Angeles" style="width:100%;">
</div>
<div class="item">
<img src="chicago.jpg" alt="Chicago" style="width:100%;">
</div>
<div class="item">
<img src="ny.jpg" alt="New york" style="width:100%;">
</div>
</div>
<!-- Left and right controls -->
<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>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.