Giter VIP home page Giter VIP logo

jquery-groupedcrossfader's Introduction

jQuery Grouped Cross Fader

This plugin takes an item, groups it's children into slugs that have a smaller width than the parent and then fades between them. Unlike many carousels, it does not need to know the width of any of the child items which can be of arbitrary and differing sizes and does not require any external css to function. It only adds css classes and values it requires to function.

Sample usage

<ul id="crossFader" style="width:1000px">
    <li style="float:left;"><img src="dummyImage.jpg" width="200" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="400" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="500" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="300" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="100" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="200" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="500" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="200" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="500" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="300" height="100" /></li>
    <li style="float:left;"><img src="dummyImage.jpg" width="100" height="100" /></li>
</ul>

<script type="text/javascript">
$(document).ready(function() { 
    $('#crossFader').groupedCrossFader();
});
</script>

Methods

  • init(): initializes the object, returns this
  • startAuto(): begins the auto fading between slugs, returns this
  • pauseAuto(): temporarily pauses the auto fading, returns this
  • next(): advances to the next slug, or loops to the first, returns this

Options

  • time: time (in ms) between transitions (default: 6000)
  • transitionSpeed: time (in ms) that individual transitions take (default: 500)
  • hoverPause: Pauses the auto transition if the user hovers over the parent (default: true)

To come in later versions:

  • Ability to add items after initialization
  • Proper destroy function
  • A selection of callbacks
  • Make it work with responsive layouts
  • Add a prettier demo

What won't be added

I want to keep this as light as possible, so I won't be adding the following

  • Carousel mod-cons like pagination and next/previous buttons. You will be able to roll your own using the callbacks.

jquery-groupedcrossfader's People

Contributors

nwe44 avatar

Stargazers

 avatar

Watchers

 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.