You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
982 B

  1. semantic.header = {};
  2. // ready event
  3. semantic.header.ready = function() {
  4. // selector cache
  5. var
  6. $increaseFont = $('.font .increase'),
  7. $decreaseFont = $('.font .decrease'),
  8. // alias
  9. handler
  10. ;
  11. // event handlers
  12. handler = {
  13. font: {
  14. increase: function() {
  15. var
  16. $container = $(this).parent().next('.sizer'),
  17. fontSize = parseInt( $container.css('font-size'), 10)
  18. ;
  19. $container
  20. .css('font-size', fontSize + 1)
  21. ;
  22. },
  23. decrease: function() {
  24. var
  25. $container = $(this).parent().next('.sizer'),
  26. fontSize = parseInt( $container.css('font-size'), 10)
  27. ;
  28. $container
  29. .css('font-size', fontSize - 1)
  30. ;
  31. }
  32. }
  33. };
  34. $increaseFont
  35. .on('click', handler.font.increase)
  36. ;
  37. $decreaseFont
  38. .on('click', handler.font.decrease)
  39. ;
  40. };
  41. // attach ready event
  42. $(document)
  43. .ready(semantic.header.ready)
  44. ;