使用Javascript而不是css重写bootstrap maxWidth

Overriding bootstrap maxWidth using Javascript and not css

本文关键字:重写 bootstrap maxWidth css Javascript 使用      更新时间:2024-03-08

所以我有一个.js文件,其中包含以下内容:

var styles = {
wrap: {
left: 0
, top: 0
, overflow: 'hidden'
, margin: 0
, padding: 0
, height: '100%'
, width: '100%'
, zIndex: -999999
}
, img: {
position: 'absolute'
, display: 'none'
, margin: 0
, padding: 0
, border: 'none'
, width: 'auto'
, height: 'auto'
, maxHeight: 'none'
, maxWidth: 'none'
, zIndex: -999999
}
};

并且maxWidth行被引导程序覆盖。我想通过有效地设置maxWidth来覆盖bootstrap!重要,但我不确定这样做的正确语法,例如:

, maxWidth: 'none !important'

不起作用。我可以通过在样式表中添加重要的规则来解决这个问题,但我正在寻找一个不需要使用样式表的解决方案。

将包含这些值的js放在引导文件之后。(或者只是为了确定,把它放在页面的末尾)