Code Monkey home page Code Monkey logo

responsive-carousel's Introduction

Responsive Carousel

This plugin creates a carousel out of a <ul> element that can be animated with mouse, touch, or keyboard. It supports minimal configuration including direction, arrows, pagination elements, and page change callback.

How To

deploying

To use call $('PARENT_ELEMENT').responsiveCarousel(); on an element that parents the list you want to form the carousel.

  • PARENT_ELEMENT should be an element with child .rcWrapper which wraps the ul.

Options

You may pass an object literal containing config options as an argument.

  • direction: 'horizontal' or 'vertical'
  • transitionSpeed: a number in milliseconds for the standard page change animation duration
  • keyControl: true/false whether to allow keyboard control
  • arrows: true/false whether to build/show arrows
  • pagination: true false whether to populate pagination elements
  • paginationEl: 'class_name' for parent of pagination elements if using pagination
  • tapToReturn: true/false whether to build a tap to return element on last page
  • callback: define a function to be called on every page change event, the scope of that function will have access to the pagination object and it's state etc...

Arrows

First looks to see if you've added two elements with class '.rcL' and '.rcR', and adds if needed. These will control the pagination. The plugin will also add class .rcHide to the left/top arrow on the first page, and to the right/bottom arrow on the last page. The class is changed on page change. This can allow you to hide the arrow if wanted with css.

Pagination

If you use pagination, the plugin will add class rcPaginationHot to the current pagination list element on page change. This allows you to style the current page in the list with css.

Callback

The callback function has access to the carousel object. This means you can use this.state to alter the carousel's style on every page change event. You can, for example check if the current slide is dark and change the arrows or pagination color accordingly.

Returns

The function returns the carousel object because I prefer to have access to the object rather than having the ability to chain jQuery methods when calling. That would be easy to switch tho.

License

This content is released under the MIT License (MIT).

responsive-carousel's People

Contributors

jerometufte avatar

Watchers

Prabhu Natarajan avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.