mirror of
https://github.com/thangisme/notes.git
synced 2024-12-22 13:26:35 -05:00
Improved search on mobile
This commit is contained in:
parent
8310df593c
commit
a6f2ed8c6c
@ -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() {
|
|||||||
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() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
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');
|
||||||
|
Loading…
Reference in New Issue
Block a user