【发布时间】:2015-06-26 21:34:43
【问题描述】:
我有一个使用媒体查询的类:
css:
@media only screen and (min-width: 58.75em)
.top-bar-section ul li {
border-left: 1px solid #fff;
transform: skewX(15deg);
}
现在,如果City() 的值是 London,我想将上面的 CSS 更改为:
@media only screen and (min-width: 58.75em)
.top-bar-section ul li {
border-left: 1px solid #fff;
transform: skewX(-15deg);
}
我的 javascript 是:
if (City() == "London"){
//change the css class from the first example to the 2nd?
}
关于如何使用 jQuery 更改类 css 的任何帮助? 谢谢, 乔什
【问题讨论】:
-
媒体查询条件相同!
-
制作第二类并使用 removeClass 和 addClass
-
@legends 变换属性值不同
-
欢迎来到 StackOverflow。您能否详细说明到目前为止您已经尝试过什么? jQuery 提供了一种
addClass()方法以及一种用于删除的方法——你试过了吗? -
如果对您有帮助,请参阅this
标签: javascript jquery css