Answer the question
In order to leave comments, you need to log in
How to make a carousel of several pictures?
The mean.js framework is used, a carousel with one slide is implemented,
here is the view code
<uib-carousel active="active" interval="myInterval" no-wrap="noWrapSlides">
<uib-slide ng-repeat="slide in slides track by slide.id" index="slide.id">
<img ng-src="{{slide.image}}" style="margin:auto;">
</uib-slide>
</uib-carousel>
angular.module('core').controller('HomeController', ['$scope', 'Authentication',
function ($scope, Authentication) {
// This provides Authentication context.
$scope.authentication = Authentication;
$scope.myInterval = 1500;
$scope.noWrapSlides = false;
var slides = $scope.slides = [];
var currIndex = 0;
for (var i = 1; i < 4; i++) {
slides.push({
image: '/modules/core/client/img/sliders/'+i+'.jpg',
id: currIndex++
});
}
}
]);
Answer the question
In order to leave comments, you need to log in
Maybe someone will come in handy, I decided as follows
view
<uib-carousel active="active" interval="myInterval" no-wrap="noWrapSlides">
<uib-slide ng-repeat="slide in slides track by slide.id" index="slide.id">
<div ng-if="slide.id==slides.length-2">
<img ng-src="{{slide.image}}">
<img ng-src="{{slides[$index+1].image}}">
<div class="imgg"></div>
</div>
<div ng-if="slide.id==slides.length-1">
<img ng-src="{{slide.image}}">
<div class="imgg"></div>
<div class="imgg"></div>
</div>
<div ng-if="(slide.id != slides.length-1) && (slide.id != slides.length-2)">
<img ng-src="{{slide.image}}">
<img ng-src="{{slides[$index+1].image}}">
<img ng-src="{{slides[$index+2].image}}">
</div>
</uib-slide>
</uib-carousel>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question