43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
/**
|
|
* Anime.js tilt interaction for the front-page platform cards.
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
function xmartica_platform_card_tilt_assets() {
|
|
if ( ! is_front_page() ) {
|
|
return;
|
|
}
|
|
|
|
$dir = get_template_directory() . '/parts/platform-card-tilt';
|
|
$uri = get_template_directory_uri() . '/parts/platform-card-tilt';
|
|
|
|
wp_enqueue_style(
|
|
'xmartica-platform-card-tilt',
|
|
$uri . '/platform-card-tilt.css',
|
|
array(),
|
|
filemtime( $dir . '/platform-card-tilt.css' )
|
|
);
|
|
|
|
wp_enqueue_script(
|
|
'xmartica-platform-card-tilt',
|
|
$uri . '/platform-card-tilt.js',
|
|
array(),
|
|
filemtime( $dir . '/platform-card-tilt.js' ),
|
|
true
|
|
);
|
|
}
|
|
add_action( 'wp_enqueue_scripts', 'xmartica_platform_card_tilt_assets' );
|
|
|
|
function xmartica_platform_card_tilt_module_tag( $tag, $handle, $src ) {
|
|
if ( 'xmartica-platform-card-tilt' !== $handle ) {
|
|
return $tag;
|
|
}
|
|
|
|
return '<script type="module" src="' . esc_url( $src ) . '"></script>';
|
|
}
|
|
add_filter( 'script_loader_tag', 'xmartica_platform_card_tilt_module_tag', 10, 3 );
|