我使用的是一个wordpress插件,它允许我生成过滤器字段。我不能直接在插件中修改css,所以我使用.addClass。
问题是,当页面加载时,插件会短暂地显示字段,而不是我在Jquery中添加的类。
如何使用适当的类直接显示这些字段?我试图用预加载器绕过这个问题,但在移动设备上,加载太长了。
You can check it here
我的代码:
$("[data-id='1']").addClass( "grid-33 suffix-66 tablet-grid-33 tablet-suffix-66 mobile-grid-50 mobile-suffix-50 bloc-arrondissement" ); $("[data-id='2']").addClass( "grid-33 tablet-grid-33 mobile-grid-100 slider-prix" ); $("[data-id='3']").addClass( "grid-33 tablet-grid-33 mobile-grid-100 slider-prix" ); $("[data-id='4']").addClass( "grid-33 tablet-grid-33 mobile-grid-100 slider-prix" );
发布于 2014-10-18 02:03:39
您需要利用WordPress wp_enqueue_style()功能,并根据需要覆盖CSS。
看起来这个插件把它的CSS排成了'sf-style-css‘。因此,如果您将一个样式排入队列,使其成为依赖项,它将确保在它之后立即加载您的CSS,从而允许您覆盖样式。您可以直接复制该样式表并在您的主题目录中修改它。
下面是主题的functions.php文件的基本示例。
function add_my_scripts_and_styles() {
wp_enqueue_style( 'my-style-overrides', get_stylesheet_uri() . '/my-style-overrides.css', 'sf-style-css' );
}
add_action( 'wp_enqueue_scripts', 'add_my_scripts_and_styles' );完整的参考资料可以在这里找到...http://codex.wordpress.org/Function_Reference/wp_enqueue_style
https://stackoverflow.com/questions/26430071
复制相似问题