Skip to content

Instantly share code, notes, and snippets.

@cole007
Created September 5, 2014 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cole007/4378617a443693490629 to your computer and use it in GitHub Desktop.
Save cole007/4378617a443693490629 to your computer and use it in GitHub Desktop.
if(viewportwidth > 1183 && !$('.page').hasClass('home') ){
$('a.icon--search').on('click touchend',function(e) {
e.preventDefault();
$(this).toggleClass('nav-active');
$(this).next('.search__form').toggleClass('search__form--active');
$('.header__secondary-menu').fadeToggle();
});
$('.search__form').css('top','5.45em');
} else {
$('a.icon--search').on('click touchend',function(e) {
e.preventDefault();
$(this).toggleClass('nav-active');
$(this).next('.search__form').toggleClass('search__form--active');
$('.header__nav_icon').removeClass('nav-active');
});
}
.search__form.search__form--active {
/* .is-vishidden makes this position:absolute */
@include triple-transition(max-height, 0.6s, padding-top, 0.3s, padding-bottom, 0.3s, ease-in-out);
display:block;
left: 0em;
top: 3.4em;
overflow: hidden;
text-align:left;
width: 100%;
height: auto;
max-height:8em;
padding: 0em $pad-and-quarter $pad-and-quarter;
border: 0;
clip: auto;
@media all and (min-width: $bp-small-5) {
top: 4.9em;
}
@media all and (min-width: $bp-xl) {
top: 9.75em;
}
}
@at-root {
//This is an adaptation for the homepage
.home .header__icon-wrap .search .search__form.search__form--active {
@media all and (min-width: $bp-xl) {
top: 5.45em;
height: auto;
max-height:8em;
}
}
.no-js .home .header__icon-wrap .search a:focus + .search__form, .no-js .home .header__icon-wrap .search .search__form:hover {
@media all and (min-width: $bp-xl) {
top: 5.45em;
height: auto;
max-height:8em;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment