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.

43 lines
705 B

  1. semantic.menu = {};
  2. // ready event
  3. semantic.menu.ready = function() {
  4. // selector cache
  5. var
  6. $menuItem = $('.menu a.item, .menu .link.item'),
  7. $dropdown = $('.main.container .menu .dropdown'),
  8. // alias
  9. handler = {
  10. activate: function() {
  11. if(!$(this).hasClass('dropdown')) {
  12. $(this)
  13. .addClass('active')
  14. .closest('.ui.menu')
  15. .find('.item')
  16. .not($(this))
  17. .removeClass('active')
  18. ;
  19. }
  20. }
  21. }
  22. ;
  23. $dropdown
  24. .dropdown({
  25. on: 'hover'
  26. })
  27. ;
  28. $menuItem
  29. .on('click', handler.activate)
  30. ;
  31. };
  32. // attach ready event
  33. $(document)
  34. .ready(semantic.menu.ready)
  35. ;