Updated search results
This commit is contained in:
parent
9a79850ddc
commit
ac6a84d88a
4 changed files with 25 additions and 5 deletions
13
CSS/*.css
13
CSS/*.css
|
@ -209,6 +209,19 @@ body{
|
||||||
.visible{
|
.visible{
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.visible-auto {
|
||||||
|
transition: ease-in-out .2;
|
||||||
|
height: auto;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
.visible-absolute {
|
||||||
|
visibility: hidden;
|
||||||
|
height: 0;
|
||||||
|
width: 0;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
.position-center{
|
.position-center{
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
|
|
@ -36,3 +36,5 @@
|
||||||
|
|
||||||
--side-bar-active: #e3edfd;
|
--side-bar-active: #e3edfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
13
JS/main.js
13
JS/main.js
|
@ -693,12 +693,13 @@ function generateSuggestWords(array) {
|
||||||
for(let i = 0; i < array.length; i++) {
|
for(let i = 0; i < array.length; i++) {
|
||||||
let div = document.createElement('div')
|
let div = document.createElement('div')
|
||||||
div.innerHTML = array[i]
|
div.innerHTML = array[i]
|
||||||
|
div.classList.add('visible-auto')
|
||||||
// div.onclick = selectSuggestedSearchOption
|
// div.onclick = selectSuggestedSearchOption
|
||||||
let hr = document.createElement('hr')
|
let hr = document.createElement('hr')
|
||||||
|
|
||||||
if(i > 5) {
|
if(i > 5) {
|
||||||
div.classList.add('disable')
|
div.classList.add('visible-absolute')
|
||||||
hr.classList.add('disable')
|
hr.classList.add('visible-absolute')
|
||||||
moreSuggestWordsArray.push(div, hr)
|
moreSuggestWordsArray.push(div, hr)
|
||||||
}
|
}
|
||||||
section.appendChild(div)
|
section.appendChild(div)
|
||||||
|
@ -707,10 +708,14 @@ function generateSuggestWords(array) {
|
||||||
}
|
}
|
||||||
function moreSuggestWords() {
|
function moreSuggestWords() {
|
||||||
if(document.querySelector('.suggested-words footer').innerHTML.trim() === 'More') {
|
if(document.querySelector('.suggested-words footer').innerHTML.trim() === 'More') {
|
||||||
moreSuggestWordsArray.forEach(element => element.classList.remove('disable'))
|
// moreSuggestWordsArray.forEach(element => element.classList.remove('visible-absolute'))
|
||||||
|
let height = document.querySelectorAll('.suggested-words section div').length * 16 + document.querySelectorAll('.suggested-words section div').length +
|
||||||
|
console.log(document.querySelectorAll('.suggested-words section div').length)
|
||||||
|
document.documentElement.style.cssText = `--suggest-more:${height}px`;
|
||||||
document.querySelector('.suggested-words footer').innerHTML = 'Less'
|
document.querySelector('.suggested-words footer').innerHTML = 'Less'
|
||||||
} else {
|
} else {
|
||||||
moreSuggestWordsArray.forEach(element => element.classList.add('disable'))
|
document.documentElement.style.cssText = `--suggest-more:auto`;
|
||||||
|
// moreSuggestWordsArray.forEach(element => element.classList.add('visible-absolute'))
|
||||||
document.querySelector('.suggested-words footer').innerHTML = 'More'
|
document.querySelector('.suggested-words footer').innerHTML = 'More'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
|
|
||||||
<?php include 'add-ons/navigation-bar.php' ?>
|
<?php include 'add-ons/navigation-bar.php' ?>
|
||||||
|
|
||||||
<div class="login-option-div grid absolute fixed" id="login-option-div">
|
<div class="login-option-div grid absolute fixed" id="login-option-div">
|
||||||
<header class="grid">
|
<header class="grid">
|
||||||
<span class="flex align-center justify-center ">Sign in to</span>
|
<span class="flex align-center justify-center ">Sign in to</span>
|
||||||
<h1 class="flex align-center justify-center ">News Website</h1>
|
<h1 class="flex align-center justify-center ">News Website</h1>
|
||||||
|
|
Loading…
Reference in a new issue