fun things

This commit is contained in:
Lazy Hippopotamus
2023-06-12 13:17:16 -04:00
parent 370041fb16
commit 667ac446e6
4 changed files with 95 additions and 42 deletions

16
main.js
View File

@@ -95,8 +95,9 @@ function getCarousel(id) {
},
display() {
var bbox = carousel.selected().getBoundingClientRect();
var bb2 = carousel.element.parentNode.getBoundingClientRect();
carousel.element.scrollBy({
left: (bbox.left - window.innerWidth/2 + bbox.width/2),
left: (bbox.left - bb2.left - bb2.width/2 + bbox.width/2),
top: 0,
behavior: "smooth"
});
@@ -110,4 +111,15 @@ function getCarousel(id) {
var carousel_1 = getCarousel("carousel_1");
carousel_1.display();
setInterval(carousel_1.nextAnim, 2000);
setInterval(carousel_1.nextAnim, 2000);
function toggle_sidebar() {
document.body.classList.toggle("sidebar-opened");
var el = document.querySelector("#sider > img");
if (document.body.classList.contains("sidebar-opened")) {
el.src = "res/arrow-left.svg";
}
else {
el.src = "res/arrow-right.svg";
}
}