searchbar overlay
This commit is contained in:
parent
7825ef8f17
commit
3b97d72f80
BIN
assets/images/vertical-ad-mock.jpg
Normal file
BIN
assets/images/vertical-ad-mock.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 104 KiB |
@ -1,17 +1,31 @@
|
||||
//Nav slide in logic
|
||||
|
||||
const nav = document.querySelector('.st-nav');
|
||||
const openButton = document.querySelector('.st-open-nav');
|
||||
const closeButton = document.querySelector('.st-close-nav');
|
||||
const openNavButton = document.querySelector('.st-open-nav');
|
||||
const closeNavButton = document.querySelector('.st-close-nav');
|
||||
|
||||
openButton.addEventListener('click', () => {
|
||||
openNavButton.addEventListener('click', () => {
|
||||
nav.classList.add('st-nav-is-open');
|
||||
});
|
||||
|
||||
closeButton.addEventListener('click', () => {
|
||||
closeNavButton.addEventListener('click', () => {
|
||||
nav.classList.remove('st-nav-is-open');
|
||||
});
|
||||
|
||||
//Search slide logic
|
||||
|
||||
const searchOverlay = document.querySelector('.st-search-overlay');
|
||||
const openSearchButton = document.querySelector('.st-open-search');
|
||||
const closeSearchButton = document.querySelector('.st-close-search');
|
||||
|
||||
openSearchButton.addEventListener('click', () => {
|
||||
searchOverlay.classList.add('st-search-is-open');
|
||||
});
|
||||
|
||||
closeSearchButton.addEventListener('click', () => {
|
||||
searchOverlay.classList.remove('st-search-is-open');
|
||||
});
|
||||
|
||||
//Sticky nav logic
|
||||
|
||||
const iconBar = document.querySelector('.st-header-icon-bar');
|
||||
|
14
header.php
14
header.php
@ -26,7 +26,7 @@
|
||||
<a href="#" class="st-chip st-chip-primary">forum</a>
|
||||
<a href="#" class="st-chip st-chip-secondary">join</a>
|
||||
<a href="#" class="st-header-icon"><i class="fa fa-user"></i></a>
|
||||
<a href="" class="st-header-icon"><i class="fa fa-search"></i></a>
|
||||
<button class="st-nav-btn st-open-search" ><i class="fa fa-search st-open-search"></i></button>
|
||||
<button class="st-nav-btn st-open-nav" aria-label="Open Navigation">☰</button>
|
||||
</div>
|
||||
|
||||
@ -46,7 +46,15 @@
|
||||
?>
|
||||
</nav>
|
||||
|
||||
<div class="st-search-overlay">
|
||||
|
||||
<div class="st-search-overlay st-main-grid">
|
||||
<button class="st-nav-btn st-close-search" aria-label="Close Search">×</button>
|
||||
<form class="st-search-form" method="get" action="/">
|
||||
<div class="st-searchbar-container">
|
||||
<input type="text" class="st-search-box" name="s" id="s" placeholder="What are you looking for?" />
|
||||
<button class="st-nav-btn st-btn-search">
|
||||
<i class="fa fa-search st-open-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</header>
|
32
style.css
32
style.css
@ -129,7 +129,8 @@ SECTIONS
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.st-nav-is-open {
|
||||
.st-nav-is-open,
|
||||
.st-search-is-open {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
|
||||
@ -165,12 +166,39 @@ SECTIONS
|
||||
color: #d3d3d3;
|
||||
}
|
||||
|
||||
.st-close-nav {
|
||||
.st-close-nav,
|
||||
.st-close-search {
|
||||
text-align: right;
|
||||
font-size: 2rem;
|
||||
height: 3rem;
|
||||
}
|
||||
|
||||
.st-search-form {
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.st-searchbar-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.st-search-box {
|
||||
outline: none;
|
||||
border: none;
|
||||
border-bottom: 2px solid #0b4fa0;
|
||||
color: #0b4fa0;
|
||||
}
|
||||
|
||||
.st-btn-search {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.st-btn-search i {
|
||||
color: #0b4fa0;
|
||||
font-size: 1.25em;
|
||||
}
|
||||
|
||||
/* footer */
|
||||
|
||||
.st-footer {
|
||||
|
Loading…
Reference in New Issue
Block a user