Posted By

stancox on 10/22/09


Tagged

css switcher


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

thatryan
dubogii
lionminister


CSS Style Switcher


 / Published in: jQuery
 

URL: http://sixrevisions.com/javascript/10-easy-jquery-tricks-for-designers/

  1. <!-- HTML -->
  2. <a href="#" class="styleswitch" rel="dark.css">Dark</a>
  3. <a href="#" class=" styleswitch " rel="light.css">Light</a>
  4.  
  5. //JavaScript
  6. <script type="text/javascript">
  7. $(".styleswitch").click(function() {
  8. $('link[rel=stylesheet]').attr('href' , $(this).attr('rel'));
  9. });
  10. </script>

Report this snippet  

You need to login to post a comment.