-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfavourite.js
27 lines (22 loc) · 948 Bytes
/
favourite.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const refreshFavorite = () => {
let aside = document.getElementById("aside");
while (aside.firstChild)
aside.removeChild(aside.firstChild)
Object.keys(localStorage).forEach(jokeId => {
createJoke("aside", JSON.parse(localStorage.getItem(jokeId)));
});
};
const addFavButton = () => {
let button = document.getElementById('toggle-menu');
button.addEventListener('click', function (event) {
event.preventDefault();
let bodyAside = document.getElementById('body');
bodyAside.classList.toggle('body-aside');
let menuToggle = document.getElementById('toggle-menu');
menuToggle.classList.toggle('body__menu-toggle_aside');
let asideBackdrop = document.getElementById('aside-backdrop');
asideBackdrop.classList.toggle('body__aside-backdrop');
let aside = document.getElementById('aside');
aside.classList.toggle('aside_show');
});
};