38 lines
1.5 KiB
JavaScript
38 lines
1.5 KiB
JavaScript
document.addEventListener("DOMContentLoaded", function() {
|
|
fetch("../php/conciertos.php")
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
let div = document.getElementById("conciertos");
|
|
div.innerHTML = ""; // Limpiar contenido
|
|
|
|
data.forEach(concierto => {
|
|
let evento = document.createElement("div");
|
|
evento.classList.add("concierto");
|
|
evento.innerHTML = `
|
|
<img src="${concierto.imagen}" alt="${concierto.nombre}">
|
|
<h2>${concierto.nombre}</h2>
|
|
<p><strong>Artista:</strong> ${concierto.artista}</p>
|
|
<p><strong>Ubicación:</strong> ${concierto.direccion}</p>
|
|
<p><strong>Fecha:</strong> ${concierto.fecha} - ${concierto.hora}</p>
|
|
<button class="btn-comprar" onclick="comprarBoletos(${concierto.id})">COMPRAR</button>
|
|
`;
|
|
div.appendChild(evento);
|
|
});
|
|
})
|
|
.catch(error => console.error("Error cargando conciertos:", error));
|
|
});
|
|
|
|
function comprarBoletos(conciertoId) {
|
|
window.location.href = `venta_boletos.html?concierto_id=${conciertoId}`;
|
|
}
|
|
|
|
// Función para desplazar los conciertos
|
|
function scrollConciertos(direction) {
|
|
const container = document.getElementById("conciertos");
|
|
const scrollAmount = 300; // Ajusta el valor para controlar la velocidad de desplazamiento
|
|
container.scrollBy({
|
|
left: direction * scrollAmount,
|
|
behavior: "smooth"
|
|
});
|
|
}
|