1
0
mirror of https://github.com/thangisme/notes.git synced 2024-12-22 07:56:25 -05:00

Improved search on mobile

This commit is contained in:
Silvio Giebl 2019-12-04 22:27:43 +01:00
parent 8310df593c
commit a6f2ed8c6c
2 changed files with 10 additions and 0 deletions

View File

@ -248,6 +248,14 @@
transition: opacity ease 200ms, width 0s, height 0s;
}
body {
overflow-y: hidden;
@include mq(md) {
overflow-y: scroll;
}
}
@include mq(md) {
.main {
position: absolute;

View File

@ -111,6 +111,7 @@ function initSearch() {
var docs = docs;
var searchInput = document.getElementById('search-input');
var searchResults = document.getElementById('search-results');
var mainHeader = document.getElementById('main-header');
function clearResults() {
searchResults.innerHTML = '';
@ -140,6 +141,7 @@ function initSearch() {
});
if (results.length > 0) {
window.scroll(0, window.scrollY + mainHeader.getBoundingClientRect().top);
document.documentElement.classList.add('search-active');
var resultsList = document.createElement('ul');