←
Volver
document.addEventListener('DOMContentLoaded', function() {
const botonVolver = document.getElementById('mp-volver');
// Detectar clics en los accesos a categorías
document.querySelectorAll('.mp-categorias-inner a').forEach(function(enlace) {
enlace.addEventListener('click', function() {
botonVolver.classList.add('mp-visible');
});
});
// Al tocar VOLVER, regresar al ancla y ocultar el botón
botonVolver.addEventListener('click', function(e) {
e.preventDefault();
const destino = document.getElementById('colorantes');
if (destino) {
destino.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
botonVolver.classList.remove('mp-visible');
});
});