function openNav(elem, state) {

  var buttons = elem.parentNode;
  var setIcon = elem.getElementsByTagName('i')[0];
  var sublist = buttons.nextSibling;
  var sublistClassList = sublist.classList;

  if (state) {
    sublistClassList.add('sn-sublistShow');
    setIcon.setAttribute('class', closeIcon);
    elem.setAttribute('onclick', 'openNav(this, false)');
  } else {
    sublistClassList.remove('sn-sublistShow');
    setIcon.setAttribute('class', openIcon);
    elem.setAttribute('onclick', 'openNav(this, true)');
  }
}
// state: (true/false) whether to open or close sublist respectively
(true/false) whether to open or close sublist respectively
( true / false ) whether to open or close sublist respectively
function openNav(elem, state) {
  var buttons = elem.parentNode;
  var setIcon = elem.getElementsByTagName('i')[0];
  var sublist = buttons.nextSibling;
  var sublistClassList = sublist.classList;
  if (state) {
    sublistClassList.add('sn-sublistShow');
    setIcon.setAttribute('class', closeIcon);
    elem.setAttribute('onclick', 'openNav(this, false)');
  } else {
    sublistClassList.remove('sn-sublistShow');
    setIcon.setAttribute('class', openIcon);
    elem.setAttribute('onclick', 'openNav(this, true)');
  }
}
function openNav ( elem , state ) { var buttons = elem . parentNode ; var setIcon = elem . getElementsByTagName ( 'i' ) [ 0 ] ; var sublist = buttons . nextSibling ; var sublistClassList = sublist . classList ; if ( state ) { sublistClassList . add ( 'sn-sublistShow' ) ; setIcon . setAttribute ( 'class' , closeIcon ) ; elem . setAttribute ( 'onclick' , 'openNav(this, false)' ) ; } else { sublistClassList . remove ( 'sn-sublistShow' ) ; setIcon . setAttribute ( 'class' , openIcon ) ; elem . setAttribute ( 'onclick' , 'openNav(this, true)' ) ; } }
state: (true/false) whether to open or close sublist respectively
state : ( true / false ) whether to open or close sublist respectively