-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
26 lines (21 loc) · 795 Bytes
/
scripts.js
File metadata and controls
26 lines (21 loc) · 795 Bytes
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
function scrollDown() {
// Altura desejada a rolar em porcentagem da altura total da página
const scrollAmountInPercent = 25; // Agora estamos rolando X% para baixo
// Obtém a altura total da página
const pageHeight = document.documentElement.scrollHeight - window.innerHeight;
// Calcula a nova posição da rolagem em pixels
const targetPositionInPx = (scrollAmountInPercent / 100) * pageHeight;
// Rola a página para a nova posição com animação suave (smooth scrolling)
window.scrollTo({
top: targetPositionInPx,
behavior: "smooth"
});
}
function myFunction() {
var x = document.getElementById("myPara");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}