43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Scroll-driven Anime.js animation for the front-page solutions title.
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
function xmartica_solutions_title_animation_assets() {
|
|
if ( ! is_front_page() ) {
|
|
return;
|
|
}
|
|
|
|
$dir = get_template_directory() . '/parts/solutions-title-animation';
|
|
$uri = get_template_directory_uri() . '/parts/solutions-title-animation';
|
|
|
|
wp_enqueue_style(
|
|
'xmartica-solutions-title-animation',
|
|
$uri . '/solutions-title-animation.css',
|
|
array(),
|
|
filemtime( $dir . '/solutions-title-animation.css' )
|
|
);
|
|
|
|
wp_enqueue_script(
|
|
'xmartica-solutions-title-animation',
|
|
$uri . '/solutions-title-animation.js',
|
|
array(),
|
|
filemtime( $dir . '/solutions-title-animation.js' ),
|
|
true
|
|
);
|
|
}
|
|
add_action( 'wp_enqueue_scripts', 'xmartica_solutions_title_animation_assets' );
|
|
|
|
function xmartica_solutions_title_module_tag( $tag, $handle, $src ) {
|
|
if ( 'xmartica-solutions-title-animation' !== $handle ) {
|
|
return $tag;
|
|
}
|
|
|
|
return '<script type="module" src="' . esc_url( $src ) . '"></script>';
|
|
}
|
|
add_filter( 'script_loader_tag', 'xmartica_solutions_title_module_tag', 10, 3 );
|