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. $buttonDropdown = $examples.filter('.button.example').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. ;
  34. $hoverDropdown
  35. .dropdown({
  36. on: 'hover',
  37. action: 'hide'
  38. })
  39. ;
  40. $buttonDropdown
  41. .dropdown({
  42. action: 'hide'
  43. })
  44. ;
  45. };
  46. // attach ready event
  47. $(document)
  48. .ready(semantic.dropdown.ready)
  49. ;