[英]AngularJS carousel: how to display part of previous and next images
How to show small parts of previous and next image in slideshow in AngularJS? 如何在AngularJS的幻灯片中显示上一张和下一张图像的一小部分? The parts of previous and next images should be displayed on desktop and tabet screens, but not on mobile 上一张和下一张图像的部分应显示在台式机和Tabet屏幕上,而不是移动设备上
This is what I already have: http://codepen.io/juliezzz/pen/qZezzx 这是我已经拥有的: http : //codepen.io/juliezzz/pen/qZezzx
<div ng-app="app">
<div ng-controller="CarouselDemoCtrl" id="slides_control">
<div>
<carousel interval="myInterval">
<slide ng-repeat="slide in slides" active="slide.active">
<img ng-src="{{slide.image}}">
<div class="carousel-caption">
<h4>Slide {{$index+1}}</h4>
</div>
</slide>
</carousel>
</div>
CSS: CSS:
#slides_control > div{
height: 200px;
}
img{
margin:auto;
width: 800px;
}
#slides_control {
width: 100%;
}
JavaScript 的JavaScript
angular.module('app', ['ui.bootstrap']);
function CarouselDemoCtrl($scope){
$scope.myInterval = 3000;
$scope.slides = [
{
image: 'http://lorempixel.com/400/200/'
},
{
image: 'http://lorempixel.com/400/200/food'
},
{
image: 'http://lorempixel.com/400/200/sports'
},
{
image: 'http://lorempixel.com/400/200/people'
}
];
}
Take a look at https://github.com/angular-ui/bootstrap/blob/master/template/carousel/carousel.html 看看https://github.com/angular-ui/bootstrap/blob/master/template/carousel/carousel.html
You can modify the template of a carousel by using the templateUrl
directive. 您可以使用templateUrl
指令来修改轮播templateUrl
。
<carousel interval="myInterval" template-url="path-to-url">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.