Code Monkey home page Code Monkey logo

quote-rotator's Introduction

JQuery Quote Rotator Plugin.

Here’s a jQuery plugin that rotates through list items with a nice fade effect. You may nest any type of element you like inside a given list item. Here’s a live demo for this project.

How to make it work.

Drop these scripts in your header:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery.quote_rotator.js" type="text/javascript" charset="utf-8"></script>

Call the function to any list element:

$(document).ready(function() {
    $('ul#quotes').quote_rotator();
});

You can specify which quote you’d like to show first by adding a class of active to the list item. If you don’t explicitly add an active class, it will default to the first item in the list.

Configuration options.

$('ul#quotes').quote_rotator({ 
     rotation_speed: 7000,                    // defaults to 5000
     pause_on_hover: false,                   // defaults to true
     randomize_first_quote: true              // defaults to false
     buttons: { next: '>>', previous: '<<' }  // defaults to false 
});

Rotation will pause on mouse hover by default. This is nice if you’re rotating through links or other elements that you might not want fading away from the user.

Also notice that next/previous buttons are not included by default. If you want buttons, you need override the buttons option. As in the example above, assign a javascript object with next and previous keys. The values will be used as text for your buttons.

Change log.

0.1.0

  • Added MIT and GPL licenses

  • New config option to randomize first quote on page load

1.0

  • Added unit tests using Jasmine

  • Revamped demo page and gh-page

  • Significant refactoring

  • Added support for next/previous buttons (issue #2)

quote-rotator's People

Contributors

coryschires avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

mazharul-miraz

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.