EDITABLE CODE:
LiveDemo:jQuery - Looping Effect
Note:If no value is returned , jQuery removes all classes from the element.