-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4193b7
commit f2d739b
Showing
9 changed files
with
241 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const openModal = document.querySelector(".js-open-gallery"); | ||
// const closeModal = document.querySelector(".js-close-gallery"); | ||
const backdropJs = document.querySelector(".js-backdrop-gallery"); | ||
|
||
// Зробили клік на ссилку через деоегування подій | ||
const link = document.querySelector(".gallery"); | ||
|
||
openModal.addEventListener("click", onOpenModal); | ||
// closeModal.addEventListener("click", onCloseModal); | ||
backdropJs.addEventListener("click", onBackdropClick); | ||
|
||
link.addEventListener("click", onCloseLinkClick); | ||
|
||
function onOpenModal() { | ||
document.body.classList.add("is-hidden"); | ||
// backdropJs.classList.toggle("is-open"); | ||
document.body.classList.add("show-modal-2"); | ||
} | ||
|
||
function onCloseModal() { | ||
document.body.classList.remove("is-hidden"); | ||
// backdropJs.classList.toggle("is-open"); | ||
document.body.classList.remove("show-modal-2"); | ||
} | ||
|
||
function onBackdropClick(event) { | ||
if (event.currentTarget === event.target) { | ||
onCloseModal(); | ||
} | ||
} | ||
|
||
function onCloseLinkClick(event) { | ||
if (event.target.nodeName === "IMG") { | ||
// console.log(event.target.nodeName); | ||
// onCloseModal(); | ||
onOpenModal(); | ||
} | ||
} | ||
|
||
function onEscKeyPress(event) { | ||
if (event.code === "Escape") { | ||
onCloseModal(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ import "./mouse"; | |
|
||
import "./timer"; | ||
import "./accordion"; | ||
import "./gallery"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
body.show-modal-2 .backdrop-3 { | ||
opacity: 1; | ||
visibility: visible; | ||
pointer-events: initial; | ||
} | ||
|
||
body.show-modal-2 .content-gallety { | ||
transform: scale(1); | ||
} | ||
|
||
.backdrop-3 { | ||
// @media screen and (max-width: 767px) { | ||
// position: fixed; | ||
// top: 0; | ||
// left: 0; | ||
// width: 100%; | ||
// height: 100%; | ||
// z-index: 40; | ||
// background-color: rgba(0, 0, 0, 0.3); | ||
// visibility: hidden; | ||
// transition: | ||
// background-color 0.45s cubic-bezier(0.4, 0, 0.2, 1), | ||
// visibility 0.45s cubic-bezier(0.4, 0, 0.2, 1); | ||
// } | ||
|
||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100vw; | ||
height: 100vh; | ||
background-color: rgba(0, 0, 0, 0.3); | ||
// z-index: 999; | ||
|
||
opacity: 0; | ||
transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1); | ||
pointer-events: none; | ||
visibility: hidden; | ||
transition: | ||
opacity 200ms ease-in-out, | ||
visibility 200ms ease-in-out; | ||
} | ||
|
||
// .js-backdrop-gallery.is-open { | ||
// // opacity: 1; | ||
// // background-color: rgba(0, 0, 0, 0.3); | ||
// visibility: visible; | ||
|
||
// // pointer-events: none; | ||
// } | ||
|
||
.content-gallety { | ||
display: flex; | ||
align-items: center; | ||
// @media screen and (max-width: $tablet) { | ||
// height: 100%; | ||
// width: 60%; | ||
|
||
// background-color: $accent-color; | ||
// transform: translateX(-100%); | ||
// // transition: transform 0.45s linear; | ||
// transition-property: all; | ||
// transition-duration: 0.65s; | ||
// transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); | ||
|
||
// // transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); | ||
// padding: 20px; | ||
// // спрятать переполнение | ||
// overflow: hidden; | ||
// } | ||
// padding: 30px; | ||
max-width: 900px; | ||
// min-height: 320px; | ||
// width: 100%; | ||
background-color: $white-color; | ||
// border-radius: 10px; | ||
// box-shadow: | ||
// 0px 1px 3px 0px rgba(0, 0, 0, 0.2), | ||
// 0px 1px 1px 0px rgba(0, 0, 0, 0.14), | ||
// 0px 2px 1px -1px rgba(0, 0, 0, 0.12); | ||
transform: scale(0.8); | ||
transition: transform 200ms ease-in-out; | ||
|
||
// @media screen and (max-width: $tablet) { | ||
// max-width: 235px; | ||
// } | ||
|
||
// @media screen and (min-width: $tablet) and (max-width: $desktop) { | ||
// max-width: 330px; | ||
// } | ||
} | ||
.prev { | ||
display: flex; | ||
} | ||
|
||
.next { | ||
display: flex; | ||
} | ||
|
||
.content-gallery__btn { | ||
display: flex; | ||
} | ||
|
||
// .backdrop-3.is-open .content-gallery { | ||
// // opacity: 1; | ||
// transform: translateX(0); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters