Socket
Socket
Sign inDemoInstall

angular-ui-carousel

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular-ui-carousel

A simple, lightweight carousel for angularjs


Version published
Weekly downloads
1.4K
decreased by-11.73%
Maintainers
1
Install size
65.5 kB
Created
Weekly downloads
 

Readme

Source

A simple, lightweight module for carousel in your AngularJS app, Inspired from http://kenwheeler.github.io/slick/. No Jquery required.

ui.carousel Demo

IE9+ (AngularJS v1.3.x no longer supports IE8) and the latest versions of Chrome, FireFox and Safari have been tested and are supported. If you do run across any issues, please submit a new issue and I'll take a look - or better yet - submit a PR with the bug fix and I'll merge it in.

You can check out basic options and demo here: http://mihnsen.github.io/ui-carousel

First version

With first version, we provide a directive ui-carousel. Basic support like slick carousel

  • arrows
  • autoplay
  • autoplaySpeed
  • cssEase
  • dots
  • fade
  • infinite
  • initialSlide
  • slidesToShow
  • slidesToScroll
  • speed
  • onBeforeChange
  • onAfterChange
  • onInit

And with angularjs it also contain

  • Filtering
Comming soon

With next version we will provide:

  • Lazy loading
  • Vertical
  • Mouse swipe event
  • Touch swipe event
  • Responsive config
  • Variable width
  • Adaptive height
  • rtl

Implementation

Requirements

AngularJS is the only dependency. Animation is achieved with pure JS, jQuery not necessary.

Installation

You can install ui-carousel with Bower.

bower install angular-ui-carousel --save

You can also install ui-carousel with npm.

npm install angular-ui-carousel --save

And as always, you can download the source files straight from this repo - they're located in the dist dir. Be sure to include the minified version of both js and css files.

Usage

Inject module

angular.module('App', ['ui.carousel']);

Directive configuration.

<ui-carousel 
  slides="ctrl.slides"
  slides-to-show="3"
  slides-to-scroll="1"
  initial-slide="1"
  autoplay="true"
  autoplay-speed="2000"
  dots="true">

  <carousel-item>
    <h3>{{ item + 1 }}</h3>
  </carousel-item>
</ui-carousel>

Provide Configuration: You can also using global configuration on angular setup like this:

app.run(['Carousel', (Carousel) => {
  Carousel.setOptions({
    arrows: true,
    autoplay: false,
    autoplaySpeed: 3000,
    cssEase: 'ease',
    dots: false,

    easing: 'linear',
    fade: false,
    infinite: true,
    initialSlide: 0,

    slidesToShow: 1,
    slidesToScroll: 1,
    speed: 500,
  });
}]);

Advanced customize

<ui-carousel 
  slides="ctrl.slides"
  slides-to-show="3"
  slides-to-scroll="1"
  on-init="ctrl.onCarouselInit()"
  on-before-change="ctrl.onCarouselBeforeChange()"
  on-after-change="ctrl.onCarouselAfterChange()">

  <!-- For slider render -->
  <carousel-item>
    <!-- placed your item content here -->
    <img src="{{ item.image }}" alt="{{ item.title }}" />
    <h3> {{ item.name }} </h3>
    <p> {{ item.description }} </h3>
    <!-- end -->
  </carousel-item>


  <!-- For customize carousel next, previous button -->
  <carousel-prev>
    <!-- placed your previous button here -->
    <button>Prev</button>
    <!-- end -->
  </carousel-prev>

  <carousel-next>
    <!-- placed your next button here -->
    <button>Next</button>
    <!-- end -->
  </carousel-next>

</ui-carousel>

Definitions

Settings

OptionTypeDefaultDescription
autoplaybooleanfalseEnables auto play of slides
autoplaySpeedint3000Auto play change interval
cssEasestring'ease'CSS3 easing
dotsbooleanfalseCurrent slide indicator dots
easingstring'linear'animate() fallback easing
fadebooleanfalseEnables fade
arrowsbooleantrueEnable Next/Prev arrows
infinitebooleantrueInfinite looping
initialSlideinteger0Slide to start on
slidesToShowint1# of slides to show at a time
slidesToScrollint1# of slides to scroll at a time
speedint300Transition speed

Callbacks

onInit()

On carousel initialized

onBeforeChange(currentSlide, nextSlide)

Fires before slide change

onAfterChange(currentSlide)

Fires after slide change

<ui-carousel 
  slides="ctrl.slides"
  slides-to-show="3"
  slides-to-scroll="1"
  on-init="ctrl.onCarouselInit()"
  on-before-change="ctrl.onCarouselBeforeChange()"
  on-after-change="ctrl.onCarouselAfterChange()">

  <carousel-item>
    <h3>{{ item + 1 }}</h3>
  </carousel-item>
</ui-carousel>

Development

If you've forked or cloned the project and would like to make any sort of adjustments, there are few items to make note of. First, your system will need to have the following bits in place:

  • Node & NPM
  • gulp
  • karma
  • Scss

Second, there are a few gulp tasks that you'll be able to leverage to help validate and prepare your changes for use.

You can fire off a gulp or gulp build command manually at any time to lint, minify, and setup your demo (built in the _gh-pages dir) for testing.

gulp (or gulp build)

Also, you can run gulp dev to lint, minify, and prep your demo for testing. Once the build is complete, it'll also fire off a watch so that any changes that are made to the the sass, js, and demo files will automatically trigger the build script to update your project.

gulp

To run through the configured unit tests, you can run gulp test. This will fire off a series of tests that check that all default options are set correctly, all configurable options are able to be set correctly, and that all methods carry out the functionality that they're supposed to. These tests should let you know if any of the updates that you've made have negatively effected any preexisting functionality. Also, when the tests complete, there will be a test coverage report generated and stored in the coverage directory.

gulp test

To public gh-pages you can using command bellow. A folder with name _gh-pages contain all file in your gh-pages repo will be generated. Read here to config your gh-pages:

gulp gh-pages

Next, you'll want to do all of your development within three locations. If you add changes anywhere else, they're likely to be overwritten during the build process. These locations are:

src/ui-carousel/*.js - for any script modifications.

src/ui-carousel/scss/*.scss - for any style modifications.

src/demo/* - for any modifications to the demo.

Lastly, once you've made your changes and run through the appropriate gulp tasks, your changes should be baked and ready for you to consume - located in the dist directory as minified js and css files.

Authors

Minh Nguyen

Credits

UI-Carousel by mihnsen inspired by http://kenwheeler.github.io/slick/

Copyright © 2016

License

UI-Carousel is under MIT license - http://www.opensource.org/licenses/mit-license.php

Keywords

FAQs

Last updated on 18 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc