使用jQuery为多个浏览器设置flexbox显示? [英] Setting flexbox display with jquery for multiple browsers?
问题描述
$(elem).css({'display':'flex','display':'-webkit-flex','display': '-MS-Flexbox的'});
尽管如此:
<$ p $ $ {code $(elem).css({'display':'flex'})
我需要另外两个Safari和IE10。有没有什么方法来写这个,以便它不会破坏我的代码? Jquery似乎对这个语法感到困惑。
我刚才遇到同样的问题。问题是你不能在同一个对象中指定 如果您不担心意外删除任何其他元素级别的样式,则可以采用以下方法之一: (当然,如果需要,还可以为IE10添加额外的一个)。 b 对不起,这么晚了,也许会帮助其他人。 having a bit of trouble. I need to have something switch from display: none to display: flex, display: flex-box, and display: -ms-flexbox but it seems to be breaking my code.. Here's what I have so far: and while this works: I need to have the other two for safari and IE10. Is there any way of writing this so that it doesn't break my code? Jquery seems confused by this syntax. I just ran across the same issue. The problem is that you can't specify multiple values of If you're not worried about accidentally removing any other element-level styles, this is one way around: (and of course add the extra one for IE10 if you need to). Sorry to be so late to the party, but maybe it will help others. 这篇关于使用jQuery为多个浏览器设置flexbox显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! display 的多个值,因为你只能有一个名为
的对象成员显示
$(elem).attr('style','display:-webkit-flex; display:flex');
$ b $(elem).css({'display': 'flex', 'display': '-webkit-flex', 'display':'-ms-flexbox'});
$(elem).css({'display': 'flex'})
display
in the same object, because you can only have one object member called display
.$(elem).attr('style', 'display: -webkit-flex; display: flex');