Toggle Cascading Style Sheets
Required JavaScript jQuery files
- stylesheetToggle.js
Click stylesheetToggle.js to view jquery file - jquery-1.3.2.js
Click jquery-1.3.2.js to view jquery file 2
1231
Toggle CSS style sheeets
This is some text to demonstrate the toggle effect!
Toggle between stylesheets.
Choose a specific different stylesheet:
CSS
JavaScript
$(function()
{
// Call stylesheet init so that all stylesheet changing functions
// will work.
$.stylesheetInit();
// This code loops through the stylesheets when you click the link with
// an ID of "toggler" below.
$('#toggler').bind(
'click',
function(e)
{
$.stylesheetToggle('slow');
return false;
}
);
// When one of the styleswitch links is clicked then switch the stylesheet to
// the one matching the value of that links rel attribute.
$('.styleswitch').bind(
'click',
function(e)
{
$.stylesheetSwitch(this.getAttribute('rel'));
return false;
}
);
}
);
HTML
<p>Toggle CSS style sheeets<br />
This is some text to demonstrate the toggle effect!</p>
<p> <a href="http://www.zerotouch.com/serversideSwitch.html" id="toggler">Toggle</a> between stylesheets.</p>
<p> Choose a specific different stylesheet:</p>
<ul>
<li><a href="http://www.zerotouch.com/?style=arial" rel="arial" class="styleswitch">Arial</a></li>
<li><a href="http://www.zerotouch.com/?style=georgia" rel="georgia" class="styleswitch">Georgia</a></li>
<li><a href="http://www.zerotouch.com/?style=trebuchet" rel="trebuchet" class="styleswitch">Trebuchet</a></li>
<li><a href="http://www.zerotouch.com/?style=mike" rel="mike" class="styleswitch">Mike</a></li>
</ul>
