Javascript 對於 !important 的處理

一直跑的很好,但是我們家的 在使用者自訂 CSS 時對 height/width 標 !important 就會爛掉...

今天花了時間去找,終於找到解法了:用 style.setProperty 蓋過去。在 這邊的程式碼裡面這樣寫:

this.style.setProperty('height', 'auto', 'important');
this.style.setProperty('width', 'auto', 'important');

改好的版本已經放到 上了:,效果可以參考 這本相本。

Leave a Reply

Your email address will not be published. Required fields are marked *