
A fully responsive image carousel slideshow which allows you to loop through multiple groups of images.
Features:
- Responsive design for both desktop and mobile devices.
- Dots and arrows navigation.
- Images can be categorized into multiple groups.
- Endless loop when you reach the last slide.
- Auto-rotation with support for pause on hover.
Dependencies:
- Angular
- jQuery Library
- Bootstrap 3
How to use it:
Include the Bootstrap’s CSS in the head section of your document.
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
Include the jQuery library, Bootstrap’s Javascript and Angular.js at the bottom of the document.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
Create the Html structure for the image carousel.
<div ng-app="carousel">
<div class="container" ng-controller="folderCtrl">
<!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" ng-repeat="img in images" class="{active : (img === 0)}" data-slide-to="{{img}}"></li>
</ol>
<div class="carousel-inner">
<div ng-class="{item: true, active : (img === 0)}" ng-repeat="img in images"> <img ng-src="{{uri}}/{{w}}/{{h}}/{{currentFolder}}/{{img}}" alt="Slide numder {{img}}">
<div class="container">
<div class="carousel-caption"> </div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a> <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a> </div>
<!-- /.carousel -->
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-botom" role="navigation">
<div class="container">
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li ng-repeat="folder in folders" class="{{activeFolder(folder)}}" ng-click="selectFolder(folder)"> <a ng-href="#{{folder}}">{{folder}}</a> </li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
</div>Active the image carousel and set the image sources in the Javascript.
var app = angular.module('carousel', []);
app.controller('folderCtrl', function ($scope, $http) {
$scope.w = window.innerWidth;
$scope.h = window.innerHeight-20;
$scope.uri = "http://lorempixel.com";
$scope.folders = [
'abstract',
'animals',
'business',
'cats',
'city',
'food',
'night',
'life',
'fashion',
'people',
'nature',
'sports',
'technics',
'transport'
];
$scope.images = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
$scope.currentFolder = $scope.folders[0];
$scope.selectFolder = function (folder) {
$scope.currentFolder = folder;
};
$scope.activeFolder = function (folder) {
return (folder === $scope.currentFolder) ? 'active' : '';
};
});







vry nice article!
gud one
this may also help u :
http://www.mindstick.com/Articles/7e957196-9b38-4041-8d77-fd8cbd2e07d0/Image%20viewer%20using%20bootstrap%20carousel
For newbies (like me) this example is lacking some information as how to organize images and folders
I have a question… what is for the $http in the “app.controller(‘folderCtrl’, function ($scope, $http)”???
I think it is not used afterwards