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.

59 lines
1.1 KiB

  1. semantic.dropdown = {};
  2. // ready event
  3. semantic.dropdown.ready = function() {
  4. // selector cache
  5. var
  6. $examples = $('.example'),
  7. $hoverDropdown = $examples.filter('.hover').find('.ui.dropdown'),
  8. $formDropdown = $examples.filter('.form').find('.ui.dropdown'),
  9. $dropdown = $examples.filter('.dropdown').find('.ui.dropdown:not(.simple)'),
  10. $transition = $examples.filter('.transition').find('.ui.dropdown'),
  11. $transitionButton = $examples.filter('.transition').find('.ui.button').first(),
  12. // alias
  13. handler
  14. ;
  15. // event handlers
  16. handler = {
  17. };
  18. $transitionButton
  19. .on('click', function(event) {
  20. $transition.dropdown('toggle');
  21. event.stopImmediatePropagation();
  22. })
  23. ;
  24. $transition
  25. .dropdown({
  26. onChange: function(value) {
  27. $transition.dropdown('setting', 'transition', value);
  28. }
  29. })
  30. ;
  31. $dropdown
  32. .dropdown({
  33. activate: true
  34. })
  35. ;
  36. $formDropdown
  37. .dropdown({
  38. action: 'updateForm'
  39. })
  40. ;
  41. $hoverDropdown
  42. .dropdown({
  43. on: 'hover'
  44. })
  45. ;
  46. };
  47. // attach ready event
  48. $(document)
  49. .ready(semantic.dropdown.ready)
  50. ;