Files

39 lines
780 B
PHP

<?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' );