Skip to content
Snippets Groups Projects
Commit a6f2ed8c authored by Silvio Giebl's avatar Silvio Giebl
Browse files

Improved search on mobile

parent 8310df59
No related branches found
No related tags found
No related merge requests found
...@@ -248,6 +248,14 @@ ...@@ -248,6 +248,14 @@
transition: opacity ease 200ms, width 0s, height 0s; transition: opacity ease 200ms, width 0s, height 0s;
} }
body {
overflow-y: hidden;
@include mq(md) {
overflow-y: scroll;
}
}
@include mq(md) { @include mq(md) {
.main { .main {
position: absolute; position: absolute;
......
...@@ -111,6 +111,7 @@ function initSearch() { ...@@ -111,6 +111,7 @@ function initSearch() {
var docs = docs; var docs = docs;
var searchInput = document.getElementById('search-input'); var searchInput = document.getElementById('search-input');
var searchResults = document.getElementById('search-results'); var searchResults = document.getElementById('search-results');
var mainHeader = document.getElementById('main-header');
function clearResults() { function clearResults() {
searchResults.innerHTML = ''; searchResults.innerHTML = '';
...@@ -140,6 +141,7 @@ function initSearch() { ...@@ -140,6 +141,7 @@ function initSearch() {
}); });
if (results.length > 0) { if (results.length > 0) {
window.scroll(0, window.scrollY + mainHeader.getBoundingClientRect().top);
document.documentElement.classList.add('search-active'); document.documentElement.classList.add('search-active');
var resultsList = document.createElement('ul'); var resultsList = document.createElement('ul');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment