-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
53 lines (44 loc) · 2.07 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
document.addEventListener('DOMContentLoaded', function() {
const avisoCookies = document.getElementById('aviso-cookies');
const fondoAvisoCookies = document.getElementById('fondo-aviso-cookies');
const btnAceptarCookies = document.getElementById('btn-aceptar-cookies');
const btnRechazarCookies = document.getElementById('btn-rechazar-cookies');
if(!localStorage.getItem('cookies-aceptadas')){
avisoCookies.classList.add('activo');
fondoAvisoCookies.classList.add('activo');
}
btnAceptarCookies.addEventListener('click', () => {
avisoCookies.classList.remove('activo');
fondoAvisoCookies.classList.remove('activo');
localStorage.setItem('cookies-aceptadas', true);
// Aquí puedes activar las cookies que necesites
});
btnRechazarCookies.addEventListener('click', () => {
avisoCookies.classList.remove('activo');
fondoAvisoCookies.classList.remove('activo');
localStorage.setItem('cookies-aceptadas', false);
// Aquí puedes desactivar las cookies no esenciales
});
fetch('header.html')
.then(response => response.text())
.then(data => {
document.getElementById('header-placeholder').innerHTML = data;
// Inicializar el menú hamburguesa DESPUÉS de cargar el header
initializeHamburgerMenu();
})
.catch(error => console.error('Error cargando el header:', error));
// Cargar el footer
fetch('footer.html')
.then(response => response.text())
.then(data => {
document.getElementById('footer-placeholder').innerHTML = data;
})
.catch(error => console.error('Error cargando el footer:', error));
// Cargar el politica de cookies
//fetch('politicaCookies.html')
//.then(response => response.text())
//.then(data => {
//document.getElementById('cookies-placeholder').innerHTML = data;
//})
//.catch(error => console.error('Error cargando la Política de Cookies:', error));
});