I have a small problem with my website. In the header there are 2 buttons with 2 different codes ( 1 for open/close the menu and 1 for open/close the search ).
This code works nice, it open and close the menu.
! function(a) {
a(".navbar-toggle").on("click", function() {
a(this).toggleClass("open"), a("#navigation").slideToggle(400)
}), a(".navigation-menu>li").slice(-1).addClass("last-elements"), a(".crspnt").on("click", function(b) {
a(window).width() < 992 && (b.preventDefault(), a(this).parent("li").toggleClass("open").find(".submenu:first").toggleClass("open"))
})
}
Also this code works nice, it open the search box:
(jQuery), $("search-btn").on("click", function() {
$("#show-search-box").css("display", "block")
});
The problem is that when the menu is open and I open the search, it looks very bad.
I need to change the 2nd code ( of the search ) and add the function that when the search button is clicked the menu close.
Any Idea?
Thank you
Remove the class from the menu:
(jQuery), $("search-btn").on("click", function() {
jQuery(".navbar-toggle").removeClass('open');
$("#show-search-box").css("display", "block")
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.