-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
69 lines (57 loc) · 2.03 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Função para fechar o popup
function closePopup() {
var popup = document.getElementById("popup");
var sections = document.getElementsByClassName("popup-section");
var popupTitle = document.getElementById("popup-title");
var titleText = document.getElementById("title-text");
if (popup && sections && popupTitle && titleText) {
popup.style.display = "none";
for (var i = 0; i < sections.length; i++) {
sections[i].classList.add("hidden");
}
popupTitle.style.display = "block";
titleText.style.display = "block";
}
}
// Função para exibir a seção correspondente ao clicar no link
function showSection(sectionId) {
var sections = document.getElementsByClassName("popup-section");
var section = document.getElementById(sectionId);
var popupTitle = document.getElementById("popup-title");
var titleText = document.getElementById("title-text");
if (sections && section && popupTitle && titleText) {
for (var i = 0; i < sections.length; i++) {
sections[i].classList.add("hidden");
}
if (section.classList.contains("initial-section")) {
popupTitle.style.display = "block";
titleText.style.display = "block";
} else {
popupTitle.style.display = "none";
titleText.style.display = "none";
}
section.classList.remove("hidden");
}
}
// Espera o carregamento completo da página
window.addEventListener("DOMContentLoaded", function () {
var popup = document.getElementById("popup");
if (popup) {
popup.style.display = "none";
}
// Função para abrir o popup
function openPopup() {
if (popup) {
popup.style.display = "block";
document.getElementById("popup-title").style.display = "block";
document.getElementById("title-text").style.display = "block";
}
}
var testeLink = document.getElementById("teste-link");
if (testeLink) {
testeLink.addEventListener("click", function (event) {
event.preventDefault();
openPopup();
});
}
});