1.0.0 • Published 8 years ago
jq-classrotation v1.0.0
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/
1.0.0
8 years ago