将css替换为“display:none”值显示:使用js显示 [英] replacing css "display:none" value with "display:flex using js

查看:991
本文介绍了将css替换为“display:none”值显示:使用js显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用js属性.css()来替换由display:flex在div上定义的css值display:none。
这样做时,Ipad上的safari忽略了js指令(我使用了前缀跨浏览器兼容性+尝试css!重要),而是应用了display:block,这是用户代理风格默认值(我也有一个reset.css)...它最终没有给我所期待的。但是,桌面浏览器不会发生此问题。任何提示覆盖Ipad上的这个默认值吗?

解决方案

尝试如下
创建一个CSS类

  .temp {
display:flex!important;



$ b

使用jquery中的addClass函数将该类动态添加到元素中

  $(selector).addClass('temp'); 


i'm attempting to replace a css value "display:none" defined on a div by a "display:flex" using js property .css(). When doing so, safari on Ipad ignores the js instruction (i used the prefixes for cross browser compatibility + tried css !important) and instead it applies "display:block" which is the user agent style defaulted value (i have a reset.css in place as well)...it ends up not giving what i'm looking for. However the issue does not occur on desktop browsers. Any tips to override this defaulted value on Ipad please?

解决方案

try as below create a CSS class

.temp{
display:flex!important;
}

add that class dynamically to the element using addClass function in jquery

$(selector).addClass('temp');

这篇关于将css替换为“display:none”值显示:使用js显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆