Created
July 31, 2019 03:40
-
-
Save shehabkhan013/bf8aaf19207e1036c01248922da74919 to your computer and use it in GitHub Desktop.
Mobile Search Option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.mobile-search { | |
position: absolute; | |
right: 65px; | |
top: 50%; | |
z-index: 9999; | |
background: #4F2271; | |
border-radius: 22.5px; | |
display: none; | |
transform: translateY(-50%); | |
} | |
.mobile-search { | |
display: block; | |
right: 85px; | |
} | |
.mobile-search input[type="search"] { | |
height: 40px; | |
width: 40px; | |
} | |
.mobile-search:after { | |
position: absolute; | |
right: 12px; | |
top: 50%; | |
content: ""; | |
background: transparent; | |
text-align: center; | |
line-height: 40px; | |
color: #fff; | |
background-image: url(assets/img/search-glass.png); | |
background-size: cover; | |
padding: 8px; | |
cursor: pointer; | |
transform: translateY(-50%); | |
z-index: 1; | |
} | |
.mobile-search input[type="search"]:focus { | |
width: 235px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="mobile-search"> | |
<div class="input-group"> | |
<input type="search" class="form-control" placeholder="Find a recipe, brand or promotion..."> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function { | |
var searchBtn = '.header-search'; | |
var searchWrap = '.search-wrap'; | |
$(searchBtn).click(function () { | |
$(searchWrap).css("display", "block"); | |
}); | |
$(document).click(function (e) { | |
if (!$(e.target).parents().andSelf().is(searchBtn)) { | |
$(searchWrap).css("display", "none"); | |
} | |
}); | |
$(searchWrap).click(function (e) { | |
e.stopPropagation(); | |
}); | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment