繁体   English   中英

jquery 设置同一个 class 的多个 css 属性具有重要

[英]jquery to set multiple css properties of a same class with important

我需要使用 jquery 将多个 css 属性设置为具有所有属性的重要关键字的相同 class 。 我的尝试如下。

$(".k-window").css({
 'bottom' : '0% !important',
 'position' : 'fixed !important'
});

但上述方式不起作用。 我知道我们是否需要添加一个重要的属性,我们可以在下面使用。

$(".k-window").css("cssText", "bottom: 0% !important;");

但是,如果我们需要为多个属性设置它,并且每个属性都很重要,会发生什么? 任何人都知道如何实现它?

So if you need to set multiple css properties using jquery to a same class with important key word for all the properties if you have 1 or more styles to change you can make it like that:

.css({
   'font-size' : '10px',
   'width' : '30px',
   'height' : '10px'
});

并使用 addClass()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM