jq-classrotation
v1.0.0
Published
Allows cycling through a list of user-defined classes
Maintainers
Readme
jq-classrotation
The classrotation jQuery plugin allows the rotation of specific user-defined classes in a html page. In order to use this plugin, you will need to set up your classes in a css stylesheet. The plugin parses an array of user-specified classes and swaps all occurences of the 'current' class with the next in the array.
Usage
- Clone the plugin into your project's global namespace
- Create a few classes
- Create an element in your DOM with one of your classes
- Create a jquery event i.e.
$('#clickme').click(function(){...}); - Inside the event, instantiate an array of your classes i.e.
var array = ["blue", "green", "yellow"];and then call the$().rotate(array);function (taking your array as a parameter). - Trigger your event
Example
An extremely basic implementation looks something like this: https://jsfiddle.net/jackphilippi/0x39Lmex/
