已修复 - 我必须在表单中添加z-index。
当我点击用户移动搜索时,它不应该关闭,因为我已经添加了e.stopPropagation,但是它会继续关闭它。我不明白为什么。
HTML:
<form class="user-mobile-search">
<input type="search" placeholder="Search Meeu">
<i class="user-mobile-search-icon icon-search"></i>
</form>
JS:
mobileSearchBtn.on('click', function(e) {
e.stopPropagation();
userNav.toggleClass('open');
mobileSearchForm.toggleClass('open');
mobileSearchBtn.toggleClass('active');
});
$('body').on('click',function() {
userNav.removeClass('open');
mobileSearchForm.removeClass('open');
mobileSearchBtn.removeClass('active');
});