function sandwich(clickEl, openEl){ $(document).on('click',clickEl,function(){ $(this).toggleClass('active'); if($(openEl).is(":visible")){ $(openEl).slideUp(); }else{ $(openEl).slideDown(); } }); } sandwich('.main_nav .sandwich_menu','.main_nav ul') sandwich('main .sandwich_menu','aside') 

This code handles the click on the computer, but does not handle the click on the phone. How to adapt it so that the click is tracked on the phone?

0