Try the following:
JQuery
$(document).ready(function() {
$("a").click(function() {
var rel = $(this).attr("rel");
$('body').hide().fadeIn(1000);
$('head').append('<link rel="stylesheet" href="'+rel+'" type="text/css" />');
});
});
HTML:
<ul>
<li><a href="#" rel="layout.css">Change to layout 1</a></li>
<li><a href="#" rel="layout2.css">Change to layout 2</a></li>
<li><a href="#" rel="layout3.css">Change to layout 3</a></li>
</ul>
Regards
source
share