Consider using the preferred .on() method rather than .click(), .bind(), .hover(), .load(), .ready(), etc. For best performance and concise code use event delegation whenever possible: https://codepen.io/32bitkid/post/understanding-delegated-javascript-events
Consider using the preferred .on() method rather than .click(), .bind(), .hover(), .load(), .ready(), etc. For best performance and concise code use event delegation whenever possible: https://codepen.io/32bitkid/post/understanding-delegated-javascript-events
var searchbtn = $('.cd-search-btn');
var searchbtnc = $('.cd-search-close');
$('.cd-search-btn-wrap').click(function() {
searchbtn.addClass('open'), $('.cd-search-btn > form > input[type="search"]').focus()
}), searchbtnc.click(function() {
searchbtn.removeClass('open')
}), $('.cd-search-btn, .cd-search-btn .cd-search-close').click(function(e) {
(e.target == this || searchbtnc == e.target.className || 27 == e.keyCode) && $(this).removeClass('open')
}),
Where you have in custom JS code, for example:
jQuery(’#selector’).click(…
replace with:
jQuery(’#selector’).on(‘click’, …
Ans so on for click, bind, hover, ready, load, resize…