more clean up and fixins

This commit is contained in:
Ginger Wong
2020-06-14 01:10:26 -07:00
parent 3ef20c5516
commit 50a59ef3c0
5 changed files with 48 additions and 45 deletions

View File

@@ -8,17 +8,24 @@ function getLocalStorage(key) {
function setLocalStorage(key, value) {
try {
localStorage.setItem(key, value);
if (value !== "" && value !== null) {
localStorage.setItem(key, value);
} else {
localStorage.removeItem(key);
}
return true;
} catch (e) {}
return false;
}
function clearLocalStorage(key) {
localStorage.removeItem(key);
}
function jumpToBottom(id) {
const div = document.querySelector(id);
console.log(div.scrollTop, div.scrollHeight , div.clientHeight)
div.scrollTo({
top: div.scrollHeight - div.clientHeight,
top: div.scrollHeight,// - div.clientHeight,
left: 0,
behavior: 'smooth'
});