var menuLeft = document.getElementById( 'cbp-spmenu-s1' ), menuRight = document.getElementById( 'cbp-spmenu-s2' ), showLeft = document.getElementById( 'showLeft' ), hideLeft = document.getElementById( 'hideLeft' ), showRight = document.getElementById( 'showRight' ), hideRight = document.getElementById( 'hideRight' ), body = document.body; showLeft.onclick = function() { classie.toggle( this, 'active' ); classie.toggle( menuLeft, 'cbp-spmenu-open' ); disableOther( 'showLeft' ); }; hideLeft.onclick = function() { classie.toggle( menuLeft, 'cbp-spmenu-open' ); disableOther( 'hideLeft' ); }; showRight.onclick = function() { classie.toggle( this, 'active' ); classie.toggle( menuRight, 'cbp-spmenu-open' ); disableOther( 'showRight' ); }; hideRight.onclick = function() { classie.toggle( this, 'active' ); classie.toggle( menuRight, 'cbp-spmenu-open' ); disableOther( 'hideRight' ); }; function disableOther( button ) { if( button !== 'showLeft' ) { classie.toggle( showLeft, 'disabled' ); } if( button !== 'showRight' ) { classie.toggle( showRight, 'disabled' ); } }