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.

53 lines
927 B

  1. semantic.dimmer = {};
  2. // ready event
  3. semantic.dimmer.ready = function() {
  4. // selector cache
  5. var
  6. $examples = $('.example'),
  7. $showButton = $examples.find('.show.button'),
  8. $pageButton = $examples.find('.page.button'),
  9. $hideButton = $examples.find('.hide.button'),
  10. // alias
  11. handler
  12. ;
  13. // event handlers
  14. handler = {
  15. show: function() {
  16. $(this)
  17. .closest('.example')
  18. .find('.segment')
  19. .dimmer('show')
  20. ;
  21. },
  22. hide: function() {
  23. $(this)
  24. .closest('.example')
  25. .find('.segment')
  26. .dimmer('hide')
  27. ;
  28. },
  29. page: function() {
  30. $('body > .page')
  31. .dimmer('show')
  32. ;
  33. }
  34. };
  35. $pageButton
  36. .on('click', handler.page)
  37. ;
  38. $showButton
  39. .on('click', handler.show)
  40. ;
  41. $hideButton
  42. .on('click', handler.hide)
  43. ;
  44. };
  45. // attach ready event
  46. $(document)
  47. .ready(semantic.dimmer.ready)
  48. ;