03.js 876 B

1234567891011121314151617181920212223242526272829
  1. $(document).ready(function () {
  2. 'use strict';
  3. $('#switcher')
  4. .hover(
  5. function () { $(this).addClass('hover'); },
  6. function () { $(this).removeClass('hover'); })
  7. .click(function (event) {
  8. if (event.target === this) {
  9. $('#switcher button').toggleClass('hidden');
  10. }
  11. });
  12. $('#switcher-default').addClass('selected');
  13. // Automatic handler names available for (jQuery 1.9.0):
  14. // blur focus focusin focusout load resize scroll unload click dblclick.
  15. // mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave
  16. // change select submit keydown keypress keyup error contextmenu.
  17. $('#switcher button').click(function () {
  18. var bodyClass = this.id.split('-')[1];
  19. $('body').removeClass().addClass(bodyClass);
  20. $('#switcher button').removeClass('selected');
  21. $(this).addClass('selected');
  22. });
  23. });