简体   繁体   English

在这种情况下,如何使用jquery更改“!important”规则?

[英]How can I use jquery to change the “!important” rule in this scenario?

I have a video in Vimeo format on my web page. 我的网页上有Vimeo格式的视频。 As I size down, at 985px and less, the video disappears and the column width goes from "560px" to "auto!important" as shown: 当我缩小到985px或更少时,视频消失,列宽从“ 560px”变为“ auto!important”,如下所示:

@media only screen and (max-width: 985px)
.main-content-area {
width: auto!important;
background: #fff;
padding: 0 20px;
}

What specific code can I use to change this line/remove it: 我可以使用什么特定的代码来更改/删除该行:

width: auto!important;

I want this line only--added as the width: 我只希望这行-添加为宽度:

min-width: 100%;

I appreciate any input. 感谢您的投入。 Thanks! 谢谢!

@media only screen and (max-width: 985px){
   .main-content-area {
      min-width: 100% !important;
   }
}

Since your css is appended after the (I presume) library's css, your css will override it. 由于您的CSS附加在(我认为)库的CSS之后,因此您的CSS将覆盖它。

If you dont wanna try it using media queries/css you may try it using jquery instead 如果您不想使用媒体查询/ css尝试,则可以使用jquery尝试

$(window).resize(function() {
  if($(window).width()<=985)
  { $('.main-content-area').css('min-width','100%'); }
});

You can also try it on $(window).load. 您也可以在$(window).load上尝试。

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

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