gregrgay

treemenu.aria.11

Jul 19th, 2018
3,758
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Plugin.prototype.toggleSubmenu = function($item) {
  2.        
  3.         if($item.children('ul').length) { // check if the treeitem contains submenu
  4.            
  5.             if ($item.hasClass('collapsed')) {  // expand if collapsed
  6.                 $item
  7.         .attr({
  8.                     'aria-expanded': true
  9.             })
  10.         .removeClass('collapsed');
  11.             } else {                            // otherwise collapse
  12.                 $item
  13.        .attr({
  14.                 'aria-expanded': false
  15.             })
  16.         .addClass('collapsed');
  17.             }
  18.         }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment