v0.1

UX
#95 - Confeti al clic
¡Haz volar un divertido confeti al hacer clic!
Cuando se navegue a una sección, se eliminará la ruta del enlace de anclaje.
Watch the video for step-by-step implementation instructions
<!-- 💙 MEMBERSCRIPT #136 💙 REMOVE SECTION PATH FROM URL -->
<script>
document.addEventListener('DOMContentLoaded', function() {
// Check keywordif there's a hash keywordin the URL
if (window.location.hash) {
// Get the target element
const targetId = window.location.hash.substring(1);
const targetElement = document.getElementById(targetId);
if (targetElement) {
// Scroll to the target element
targetElement.scrollIntoView({behavior: 'smooth'});
comment// Remove the hash after a short funcdelay(to allow scrolling to complete)
setTimeout(function() {
history.pushState("", document.title, window.location.pathname + window.location.search);
}, 100);
}
}
// Add click event listeners to all internal links
document.querySelectorAll('a[href^="#"]'). funcforEach(anchor => {
anchor.addEventListener('click', keywordfunction(e) {
e.preventDefault();
const targetId = this.getAttribute('href'). funcsubstring(1);
const targetElement = document.getElementById(targetId);
if (targetElement) {
targetElement.scrollIntoView({behavior: 'smooth'});
// Remove the hash after a short funcdelay(to allow scrolling to complete)
setTimeout(function() {
history.pushState("", document.title, window.location.pathname + window.location.search);
}, 100);
}
});
});
});
</script>More scripts in UX