首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Deque动画CSS

Deque动画CSS
EN

Stack Overflow用户
提问于 2021-01-15 17:05:15
回答 1查看 454关注 0票数 2

我正在尝试开发一个动画库,这个库是在一个特定的页面上加载时附带的。这是脚本https://wpcalculators.com.ng/wp-content/plugins/elementor/assets/lib/animations/animations.min.css?ver=3.0.16的URL

我使用了这个代码:

代码语言:javascript
复制
//Remove animation
function remove_animation() {
    if(is_page([19] )):
 wp_dequeue_style( 'elementor-animations' );
    endif;
}
add_action( 'wp_enqueue_scripts', 'remove_animation', 100 );

但这是行不通的。

我使用了类似的代码来阻止Gutenberg块库的加载,它起了作用。

代码语言:javascript
复制
//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似乎是“元素-动画”

否则,我如何才能编写代码使其工作呢?

注意:我知道当我用分页的洞察力测试URL时,它是不起作用的。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-16 02:53:24

可能,在去队列之前,取消注册样式可以解决这个问题。

代码语言:javascript
复制
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 );
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65740431

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档