Open / close searchform
Omschrijving
// opens the search input in the main menu.
//—————————————-
$(‘#header form.searchform .input-group button’).click(function() {
var element = $(this);
setTimeout(function(){
$(element).parent().parent().find(‘.input-group-field’).focus();
}, 1000);
if(!$(this).parent().parent().parent().hasClass(‘open’) || $(this).parent().parent().find(‘input’).val()==””) {
$(this).parent().parent().parent().toggleClass(‘open’);
return false;
} else {
return true;
}
});
$(document).click(function(event) {
// desktop
if(!$(event.target).closest(‘.desktop__searchform form’).length) {
if($(‘.desktop__searchform form’).hasClass(“open”) ) {
$(‘.desktop__searchform form’).removeClass(‘open’);
}
}
// mobile
if (!$(event.target).closest(‘.mobile__searchform form’).length ) {
if($(‘.mobile__searchform form’).hasClass(“open”) ) {
$(‘.mobile__searchform form’).removeClass(‘open’);
}
}
});
Snippet
| Field | Value |
|---|---|
| Snippet Status | |
| Snippet Description | |
| Snippet Type Code | |
| Snippet URL | |
| Snippet Content | |
| Snippet Content CSS | |
| Snippet Content HTML | |
| Snippet Content JS | |
| Snippet Content PHP | |
| Particle Snippet in Software | |
| Particle Snippet in Boilerplate |
Relations
| Item | Type |
|---|
Pointing items
| Item | Type | Category | Tags |
|---|