Stylesheet switcher --> Buttons for PREV & NEXT
Hello everybody!
I have a simple
jQuery Style Switcher, which can apply
new stylesheet from additional CSS file .
It's working with standard buttons --> each button applies different style.
But I just want to add two buttons more to this navigation:
previous & next (with loop).
I have tried to make it by myself but without success..
Here is working demo in Plunker:
LINK
Function
- $('.list a').click(function() {
var rel = $(this).attr('rel');
$('.content').fadeOut(500, function(){
$('.content').hide().fadeIn(500);
$('head').append('<link rel="stylesheet" href="' + rel + '" type="text/css" />');
});
});
HTML
- <div class="content"></div>
<div class="list">
<a href="#" rel="style1.css">Style 1</a>
<a href="#" rel="style2.css">Style 2</a>
<a href="#" rel="style3.css">Style 3</a>
</div>
Any help?