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.2 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), .inline.dropdown, .icon.buttons .button, .form .dropdown.selection'),
  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. console.log($transition);
  28. $transition.dropdown('setting', 'transition', value);
  29. }
  30. })
  31. ;
  32. $dropdown
  33. .dropdown()
  34. ;
  35. $hoverDropdown
  36. .dropdown({
  37. on: 'hover',
  38. action: 'hide'
  39. })
  40. ;
  41. $buttonDropdown
  42. .dropdown({
  43. action: 'hide'
  44. })
  45. ;
  46. };
  47. // attach ready event
  48. $(document)
  49. .ready(semantic.dropdown.ready)
  50. ;