双端队列动画 CSS
Deque Animation CSS
我正在尝试将 elementor 附带的动画库加载到特定页面上。这是脚本的 URL
https://wpcalculators.com.ng/wp-content/plugins/elementor/assets/lib/animations/animations.min.css?ver=3.0.16
我用过这个代码:
//Remove animation
function remove_animation() {
if(is_page([19] )):
wp_dequeue_style( 'elementor-animations' );
endif;
}
add_action( 'wp_enqueue_scripts', 'remove_animation', 100 );
但它不起作用。
我使用类似的代码将古腾堡块库加载到 deque 中,它起作用了。
//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css() {
if(is_page([19] )):
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
endif;
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );
我从源代码中确认了 CSS 的 ID:
Id好像是'elementor-animations'
我还可以如何编写代码使其工作?
注意:当我使用 pagespeed insight 测试 URL 时,我知道它不起作用。
可能,在取消队列之前取消注册样式可以解决问题
function remove_animation() {
if ( is_page( [ 19 ] ) ):
wp_deregister_style( 'elementor-animations' );
wp_dequeue_style( 'elementor-animations' );
endif;
}
add_action( 'wp_enqueue_scripts', 'remove_animation', 100 );
我正在尝试将 elementor 附带的动画库加载到特定页面上。这是脚本的 URL https://wpcalculators.com.ng/wp-content/plugins/elementor/assets/lib/animations/animations.min.css?ver=3.0.16
我用过这个代码:
//Remove animation
function remove_animation() {
if(is_page([19] )):
wp_dequeue_style( 'elementor-animations' );
endif;
}
add_action( 'wp_enqueue_scripts', 'remove_animation', 100 );
但它不起作用。
我使用类似的代码将古腾堡块库加载到 deque 中,它起作用了。
//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css() {
if(is_page([19] )):
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
endif;
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );
我从源代码中确认了 CSS 的 ID:
Id好像是'elementor-animations'
我还可以如何编写代码使其工作?
注意:当我使用 pagespeed insight 测试 URL 时,我知道它不起作用。
可能,在取消队列之前取消注册样式可以解决问题
function remove_animation() {
if ( is_page( [ 19 ] ) ):
wp_deregister_style( 'elementor-animations' );
wp_dequeue_style( 'elementor-animations' );
endif;
}
add_action( 'wp_enqueue_scripts', 'remove_animation', 100 );