$(document).ready(function(){ if($(window).width() <= 414){ $('#secondmenu .leftmenu h4').click(function(){ if($(this).parent().children('.dep03').hasClass('on')==1){ $(this).parent().children('.dep03').removeClass('on'); }else { $(this).parent().children('.dep03').addClass('on'); } }) } })