GithubHelp home page GithubHelp logo

nvdnkpr / cavendish.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from michaek/cavendish.js

0.0 2.0 0.0 237 KB

a jQuery plugin that's focused on helping you with your slides.

Home Page: http://michaek.github.com/cavendish.js/

License: GNU General Public License v2.0

cavendish.js's Introduction

About

Cavendish is intended to be a very simple slide manager based on CSS transitions. Initializing Cavendish sets up an iterator for your slides, which applies classes to your slides based on their relationship to the current slide. Everything else is up to you!

Cavendish doesn't try to polyfill for old browsers, or to provide any extra interaction - it's just meant to provide a platform for custom interaction by managing the state of your slides. I think you'll find it refreshing!

Usage

Cavendish is written in Coffeescript, but it works like an ordinary jQuery plugin:

$('.slideshow').cavendish();

We can also send special commands.

$('.cavendish').cavendish('prev');

Or get a reference to the Cavendish object.

var cavendish = $('.cavendish').cavendish('cavendish');
cavendish.prev();

Plugins

Cavendish provides a few interaction plugins that you can choose to use - none are enabled by default. You can enable them with the use_plugins option:

$('.cavendish').cavendish({use_plugins: ['player']});

Player

Auto-advances between slides and pauses on hover. You can call start and stop methods on the plugin from the Cavendish object. It's a little verbose, currently:

var cavendish = $('.cavendish').cavendish('cavendish');
cavendish.plugins['player'].start();

In the initial version of Cavendish, the player was part of the core library and enabled by default. Now it's just another plugin, and you've got to include it in your cavendish() initialization, or override the defaults by setting:

$.fn.cavendish.defaults['use_plugins'] = ['player']

Pager

Connects a list of links to your slides, and clicking on a link navigates to the slide. It doesn't try to generate a pager for you, so you're able to provide exactly the HTML you need to create the effect you're going for.

Arrows

Connects a previous and next link to the prev() and next() methods on your cavendish object. If you've set the loop option to false, the links will get a disabled class when you get to the beginning or end - otherwise you can click around the list forever.

Pan

This is a slightly unusual feature, but it's one I use a lot so I included it! It takes an element within the cavendish parent element, and positions it absolutely based on the current slide index. This can also be used as a parallax effect, if you set the panFactor option to a smaller number - it's 1 by default, which represents the entire width of the slideshow.

Events

Exposes cavendish events so you can hook in your own code without writing a cavendish plugin of your own. Once it's enabled, events are fired on the cavendish parent element:

  • cavendish-setup: When the cavendish element is initialized, but before any transitions have been triggered
  • caventish-transition: On each transition between slides. It's also fired on the first slide after setup.

cavendish.js's People

Contributors

michaek avatar

Watchers

Navid Nikpour avatar  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.