-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
28 lines (25 loc) · 1 KB
/
script.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
28
const modalOverlay = document.querySelector('.modal-overlay')
const cards = document.querySelectorAll('.card')
const modal = document.querySelector('.modal')
for(let card of cards) {
card.addEventListener("click",function(){
const linkId = card.getAttribute("id")
modalOverlay.classList.add('active')
modalOverlay.querySelector('iframe').src = `https://rocketseat.com.br/${linkId}`
})
}
const closeModal = document.querySelector('.close-modal').addEventListener("click", function(){
let isMaximized = modal.classList.contains("maximize")
if(isMaximized){
modal.classList.remove('maximize')
} modalOverlay.classList.remove("active")
modalOverlay.querySelector("iframe").src = ""
})
const expandModal = document.querySelector('.expand-modal').addEventListener("click", function(){
let isMaximized = modal.classList.contains("maximize")
if(isMaximized){
modal.classList.remove('maximize')
} else {
modal.classList.add('maximize')
}
})