-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
104 lines (73 loc) · 1.96 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//Slide de Fotos Automático
let time = 3000,
currentImageIndex = 0,
images = document
.querySelectorAll(".banner img")
max = images.length;
function nextImage() {
images[currentImageIndex]
.classList.remove("selected")
currentImageIndex++
if(currentImageIndex >= max)
currentImageIndex = 0
images[currentImageIndex]
.classList.add("selected")
}
function start() {
setInterval(() => {
// troca de image
nextImage()
}, time)
}
window.addEventListener("load", start)
//Slide de Fotos Manual
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n){
showDivs(slideIndex += n);
}
function showDivs(n){
var i;
var x = document.getElementsByClassName("imagem-slides");
if (n > x.length){
slideIndex = 1
}
if ( n < 1){
slideIndex = x.length
};
for(i = 0; i <x.length; i++){
x[i].style.display = "none";
}
x[slideIndex-1].style.display = "block";
}
function bolos(tipoDeBolo) {
var i;
var x = document.getElementsByClassName("bolos");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
document.getElementById(tipoDeBolo).style.display = "flex";
}
//Script para função com scroll suave
$(document).ready(function(){
$("a").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 1200, function(){
window.location.hash = hash;
});
}
});
});
//MENU RESPONSIVO ROCKSEAT
let show = true;
const menuSection = document.querySelector(".menu-section");
const menuToggle = menuSection.querySelector(".menu-toggle");
menuToggle.addEventListener("click", () => {
document.body.style.overflow = show ? "hidden" : "initial";
menuSection.classList.toggle("on", show)
show = !show;
})