thema de comienzo con efectos

This commit is contained in:
2026-09-22 21:37:59 -06:00
commit 6247ae7cc5
67 changed files with 5604 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
/* Lenis smooth scroll (from trivelta-html). Native smooth scroll fights Lenis. */
html.lenis,
html.lenis body {
height: auto;
}
.lenis.lenis-smooth {
scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
overscroll-behavior: contain;
}
.lenis.lenis-stopped {
overflow: hidden;
}
.lenis.lenis-scrolling iframe {
pointer-events: none;
}
+82
View File
@@ -0,0 +1,82 @@
/* Lenis smooth scroll from trivelta-html: lerp 0.09, wheel only.
Same-page hashes use absolute URLs in WordPress, so those scroll too. */
(function () {
var reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (reduceMotion || !window.Lenis) {
return;
}
var lenis = new window.Lenis({
lerp: 0.09,
smoothWheel: true,
smoothTouch: false
});
function raf(time) {
lenis.raf(time);
window.requestAnimationFrame(raf);
}
window.requestAnimationFrame(raf);
function anchorOffset() {
var header = document.querySelector('header');
if (!header) {
return -70;
}
var position = window.getComputedStyle(header).position;
if (position === 'fixed' || position === 'sticky') {
return -Math.round(header.getBoundingClientRect().height);
}
return 0;
}
document.addEventListener('click', function (event) {
if (event.defaultPrevented || event.button) {
return;
}
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
return;
}
var anchor = event.target.closest ? event.target.closest('a') : null;
if (!anchor || (anchor.target && anchor.target !== '_self')) {
return;
}
var url;
try {
url = new URL(anchor.href, window.location.href);
} catch (error) {
return;
}
if (!url.hash || url.hash === '#') {
return;
}
if (url.origin !== window.location.origin || url.pathname !== window.location.pathname || url.search !== window.location.search) {
return;
}
var target = document.querySelector(url.hash);
if (!target) {
return;
}
event.preventDefault();
lenis.scrollTo(target, {
offset: anchorOffset(),
duration: 1.1
});
});
}());
+38
View File
@@ -0,0 +1,38 @@
<?php
/**
* Lenis smooth scroll, same setup as trivelta-html.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function alcastromol_smooth_scroll_assets() {
$dir = get_template_directory() . '/parts/smooth-scroll';
$uri = get_template_directory_uri() . '/parts/smooth-scroll';
wp_enqueue_style(
'alcastromol-smooth-scroll',
$uri . '/smooth-scroll.css',
array(),
filemtime( $dir . '/smooth-scroll.css' )
);
wp_enqueue_script(
'lenis',
'https://cdn.jsdelivr.net/npm/lenis@1.1.14/dist/lenis.min.js',
array(),
'1.1.14',
true
);
wp_enqueue_script(
'alcastromol-smooth-scroll',
$uri . '/smooth-scroll.js',
array( 'lenis' ),
filemtime( $dir . '/smooth-scroll.js' ),
true
);
}
add_action( 'wp_enqueue_scripts', 'alcastromol_smooth_scroll_assets' );