Angular Carousel - Mobile friendly touch carousel for AngularJS
npm install angular-carouselAn AngularJS 1 carousel implementation optimised for mobile devices.
This project is not maintained anymore, and looking for maintainers.
Demo : http://revolunet.github.io/angular-carousel
Comments and contributions welcome :)
Proudly brought to you by the @revolunet team.
bower install angular-carouselnpm install angular-carouselIf you don't use NPM or Bower, just download files from the github repo
angular-touch.js and angular-carousel.js to your code:html
`
- Or just require the module the CommonJS way (if you use npm)
`js
var angular = require('angular');
var ngTouch = require('angular-touch');
var carousel = require('angular-carousel');
`
- Add angular-carousel.css to your code:
`html
`
- Add a dependency to the angular-carousel module in your application.
`js
angular.module('MyApp', ['angular-carousel']);
` - Add a
rn-carousel attribute to your block and your 's become magically swipable ;)
`html
{{ image }}
` - You can also use
rn-carousel without ng-repeat ;)
`html
- slide #1
- slide #2
- slide #3
`Directive options :
- rn-carousel-index two way binding integer to control the carousel position (0-indexed)
- rn-rn-carousel-html-slides: two way binding array to get slides if no ng-repeat was used (slides array)
- rn-carousel-buffered add this attribute to enable the carousel buffering, good to minimize the DOM (5 slides)
- rn-carousel-controls add this attribute to enable builtin prev/next buttons (you can override by CSS)
- rn-carousel-auto-slide add this attribute to make the carousel slide automatically after given seconds (default=3)
- rn-carousel-transition : transition type, can be one of slide, zoom, hexagon, fadeAndSlide, none. (default=slide)
- rn-carousel-locked: two way binding boolean that lock/unlock the carousel
- rn-carousel-deep-watch: Deep watch the collection which enable to dynamically add slides at beginning without corrupting position
- rn-carousel-easing: add this attritube to specify a formula for easing, these can be found in the shifty
library (default=easeIn)
- rn-carousel-duration: add this attribute to set the duration of the transition (default=300)
- rn-carousel-controls-allow-loop: add this attribute to allow looping through slides from prev/next controlsIndicators
You can add position indicators by adding this directive where you want :
`html
`
- slides is the same collection you use in the carousel ng-repeatNote: If loading in slides from an async service, the
ng-if="slides.length > 1" may not update as expected. In this case, try ng-if="slides". -
carouselIndex is the same index you've defined for the carousel Note: If the indicators don't seem to update with the slides, try binding to an object param i.e.
carousel.index, set in the controller like $scope.carousel.index = 0` Explanation.