-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #720 from FitzwilliamMuseum/feature/search-box
Feature/search box
- Loading branch information
Showing
13 changed files
with
149 additions
and
26 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"/js/app.js": "/js/app.js?id=d943ffce7f0f0ac2aa46aad28f04864c", | ||
"/css/app.css": "/css/app.css?id=730c9590b4cbcf32e52823f1521c3307", | ||
"/css/fitzwilliam.css": "/css/fitzwilliam.css?id=0b0ee8fa97e5ae468652dd2d4ff1fba1" | ||
"/js/app.js": "/js/app.js?id=b8905b220a3026e29c691fbcf7f1ab86", | ||
"/css/app.css": "/css/app.css?id=0b507e855f6ef0d9dc4aab21328475d9", | ||
"/css/fitzwilliam.css": "/css/fitzwilliam.css?id=ac5439ad1da7ccbbd3f994488e57982e" | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
window.addEventListener("DOMContentLoaded", () => { | ||
const search_button = document.querySelector("#search-btn"); | ||
const main_search = document.querySelector("#main-search"); | ||
const main_navbar = document.querySelector("nav.navbar"); | ||
const head = document.querySelector(".head.parallax"); | ||
const navbar_toggler = document.querySelector(".navbar-toggler"); | ||
|
||
function updateMargins() { | ||
const navbarHeight = main_navbar.getBoundingClientRect().height; | ||
const searchHeight = main_search.getBoundingClientRect().height; | ||
|
||
main_search.style.top = navbarHeight + "px"; | ||
head.style.setProperty("margin-top", (searchHeight + navbarHeight) + "px", "important"); | ||
|
||
if (navbar_toggler.classList.contains("show")) { | ||
main_search.style.top = navbarHeight + "px"; | ||
main_search.style.minHeight = "0px"; | ||
main_search.style.padding = "40px 16px 60px 16px"; | ||
head.style.setProperty("margin-top", "0", "important"); | ||
} | ||
} | ||
|
||
search_button.addEventListener("click", () => { | ||
if (main_search.hasAttribute("hidden")) { | ||
main_search.removeAttribute("hidden"); | ||
updateMargins(); | ||
} else { | ||
main_search.setAttribute("hidden", "true"); | ||
head.style.setProperty("margin-top", 0); | ||
main_search.style.setProperty("top", 0); | ||
} | ||
}); | ||
|
||
navbar_toggler.addEventListener("click", () => { | ||
if (main_search.hasAttribute("hidden")) { | ||
const navbarHeight = main_navbar.getBoundingClientRect().height; | ||
main_search.removeAttribute("hidden"); | ||
main_search.style.top = (navbarHeight) + "px"; | ||
main_search.style.minHeight = 0; | ||
main_search.style.padding = "0 16px 40px 16px"; | ||
head.style.setProperty("margin-top", (navbarHeight) + "px", "important"); | ||
} | ||
main_search.setAttribute("hidden", "true"); | ||
main_search.style.top = 0; | ||
head.style.setProperty("margin-top", 0); | ||
}); | ||
|
||
window.addEventListener("resize", updateMargins); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#main-search { | ||
background: black; | ||
border: none; | ||
display: flex; | ||
position: absolute; | ||
left: 0; | ||
margin: 0; | ||
min-height: 100%; | ||
padding: 40px 16px; | ||
width: 100%; | ||
} | ||
|
||
.main-search-wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
margin: 0 auto; | ||
max-width: 1290px; | ||
width: 100%; | ||
} | ||
|
||
.main-search-label { | ||
font-size: 46px; | ||
font-weight: 500; | ||
color: white; | ||
margin-bottom: 24px; | ||
} | ||
|
||
.main-search-label span { | ||
display: none; | ||
|
||
@media screen and (min-width: 500px) { | ||
display: inline; | ||
} | ||
} | ||
|
||
.main-search-input { | ||
padding: 26.5px 0 26.5px 20px; | ||
border: 1px solid white; | ||
background: transparent !important; | ||
color: white !important; | ||
font-size: 18px; | ||
width: 100%; | ||
} | ||
|
||
.main-search-input::placeholder { | ||
color: white !important; | ||
} | ||
|
||
.main-search-btn { | ||
position: absolute; | ||
top: 50%; | ||
right: 10px; | ||
transform: translateY(-50%); | ||
} | ||
|
||
.collapsing { | ||
transition: none; | ||
} |
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
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
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
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
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
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