Hello. Tell me how to make a competent check on the availability of the condition.
There is a piece of code that is responsible for deleting several classes by touch event. In the result of the check ($('#popup_new_custom_kit').hasClass('popup-show')) = true It is necessary that the code does not work, the classes are not deleted
Initial code
function closeSelectKitTouch() { $(document).on('touchstart' && 'touchend', function (e) { var container = $(".swipe-menu"); if (container.has(e.target).length === 0) { $('.wrapper ').removeClass('active-swipe-menu'); $('#main-wrap').removeClass('active-swipe-menu'); } }); } Changed code (everything works as it should)
function closeSelectKitTouch() { $(document).on('touchstart' && 'touchend', function (e) { if ($('#popup_new_custom_kit').hasClass('popup-show')) { // что тут должно быть? } else { var container = $(".swipe-menu"); if (container.has(e.target).length === 0) { $('.wrapper ').removeClass('active-swipe-menu'); $('#main-wrap').removeClass('active-swipe-menu'); } } }); } I'm embarrassed by the fact that my actions for if are just empty.
Actually this is the question whether it is possible to leave? Or what should be there?