My goal is to cycle through different fonts with the click of an arrow. I just started learning Javascript and jQuery, but I found the jQuery in another thread, and changed the parts I understood.
I get the jist of how this is working, but I don't know what to change $('.p1, .p2, .p3').click(function()
to to make this work. I imagine this.className
is part of the issue as well. Any help or direction is appreciated!
jsFiddle: http://jsfiddle.net/CSS_Apprentice/dL8tvqy9/2/
HTML:
<div>
<div class="leftArrow"></div>
<div class="rightArrow"></div>
</div>
<div class="p1"></div>
jQuery:
$('.p1, .p2, .p3').click(function() {
this.className = {
p3 : 'p1', p1: 'p2', p2: 'p3'
}[this.className];
});