-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
112 lines (86 loc) · 2.97 KB
/
index.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
103
104
105
106
107
108
109
110
111
$(document).ready(function () {
$('#singup').click(function () {
;
$('#singup_container').css('visibility', 'visible');
});
$('#close_singup').click(function () {
$('#singup_container').css('visibility', 'hidden');
});
$('#singin').click(function () {
$('#singin_container').css('visibility', 'visible');
});
$('#close_singin').click(function () {
$('#singin_container').css('visibility', 'hidden');
});
$('#basket_button_id').click(function () {
$('#basket_container').css('visibility', 'visible');
});
$('#close_basket').click(function () {
$('#basket_container').css('visibility', 'hidden');
});
$('#menu_button').click(function () {
let yOffset = parseInt(-document.getElementsByTagName('nav')[0].clientHeight);
const element = document.getElementById("menu");
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
window.scrollTo({
top: y,
behavior: 'smooth'
});
});
$('#kontakt_button').click(function () {
let yOffset = parseInt(-document.getElementsByTagName('nav')[0].clientHeight);
const element = document.getElementById("kontakt");
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
window.scrollTo({
top: y,
behavior: 'smooth'
});
});
$(function () {
var navMain = $(".collapse");
navMain.on("click", "a", null, function () {
navMain.collapse('hide');
});
});
// Kolo fortuny - promocje
let container = document.querySelector(".container");
let btn = document.getElementById("spin");
let number = Math.ceil(Math.random() * 1080);
btn.onclick = function () {
container.style.transform = "rotate(" + number + "deg)";
let temp = (number + 22.5) % 360;
if (temp >= 0 && temp <= 44) {
}
if (temp >= 45 && temp <= 89) {
}
if (temp >= 90 && temp <= 134) {
}
if (temp >= 135 && temp <= 179) {
}
if (temp >= 180 && temp <= 224) {
}
if (temp >= 225 && temp <= 269) {
}
if (temp >= 270 && temp <= 314) {
}
if (temp >= 315 && temp <= 359) {
}
}
document.addEventListener('mouseup', function (e) { //Funkcja która ukrywa diva z promocja po nacisnieciu poza obręb diva
let container = document.getElementsByClassName('spin')[0];
if (!container.contains(e.target)) {
container.style.display = 'none';
}
});
});
function showDiv() {
if (document.getElementById('google').style.display == "block") {
document.getElementById('google').style.display = "none";
}
else {
document.getElementById('google').style.display = "block";
}
}
function showWheel() {
document.getElementsByClassName('spin')[0].style.display = "inline";
}