mirror of
https://github.com/hnasheralneam/hnasheralneam.github.io.git
synced 2025-06-06 21:34:15 -04:00
Put navbar on bottom for mobile, carousel takes full width on mobile, double click for next carousel slide, slow project carousel
This commit is contained in:
parent
ebb8568ca1
commit
3b02e5258c
3 changed files with 54 additions and 4 deletions
|
@ -119,6 +119,17 @@ document.querySelector(".carousel").addEventListener("click", (event) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.querySelector(".carousel").addEventListener("dblclick", (event) => {
|
||||||
|
console.log("hi")
|
||||||
|
if (event.target.parentElement.parentElement.classList.contains("active")) {
|
||||||
|
if ((Date.now() - lastChange) < 500) return;
|
||||||
|
nextSlide();
|
||||||
|
resetCarouselLoop();
|
||||||
|
lastChange = Date.now();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function nextSlide() {
|
function nextSlide() {
|
||||||
activeIndex = (activeIndex + 1) % items.length;
|
activeIndex = (activeIndex + 1) % items.length;
|
||||||
updateCarousel();
|
updateCarousel();
|
||||||
|
@ -130,10 +141,10 @@ function lastSlide() {
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCarousel();
|
updateCarousel();
|
||||||
carouselLoop = setInterval(nextSlide, 2000);
|
carouselLoop = setInterval(nextSlide, 4000);
|
||||||
|
|
||||||
function resetCarouselLoop() {
|
function resetCarouselLoop() {
|
||||||
lastChange = Date.now();
|
lastChange = Date.now();
|
||||||
clearInterval(carouselLoop);
|
clearInterval(carouselLoop);
|
||||||
carouselLoop = setInterval(nextSlide, 2000);
|
carouselLoop = setInterval(nextSlide, 4000);
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
.carousel {
|
.carousel {
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
padding: 0 0;
|
padding: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
transition: 0.6s;
|
transition: 0.8s;
|
||||||
opacity: 0.1;
|
opacity: 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +128,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media only screen and (max-width: 750px) {
|
||||||
|
.carousel-inner {
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
.carousel-item-inner {
|
||||||
|
width: 100vw;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.carousel-item-inner img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
.title {
|
.title {
|
||||||
|
|
|
@ -127,6 +127,32 @@ a {
|
||||||
margin: 1rem auto;
|
margin: 1rem auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 700px) {
|
||||||
|
.menu {
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
top: auto;
|
||||||
|
width: auto;
|
||||||
|
height: 5rem;
|
||||||
|
}
|
||||||
|
.menu div {
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.menu:hover {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.menu .item {
|
||||||
|
display: inline-flex;
|
||||||
|
margin: auto .5rem;
|
||||||
|
transform: scale(1.3);
|
||||||
|
}
|
||||||
|
.menu .item:hover {
|
||||||
|
margin: auto 1rem;
|
||||||
|
transform: scale(1.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
.menu .item {
|
.menu .item {
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue