我與CSS3變量時,以抵消在運行項目和許多其他的事情但是JQuery的CSS方法忽略在設定一個css變種的任何企圖。我嘗試以下
$(document).ready(function() {
$('#testdiv').css('--bgc','rgb(0,0,255)');
});
div
{
--bgc:rgb(255,0,0);
background-color:var(--bgc);
width:50px;
height:50px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<div id="testdiv"></div>
所以理論上股利應首先由50像素紅色框加載爲50像素,並儘快頁面加載完成後改變成一個藍色的盒子,不過--bgc變量永遠不會在DIV上改變。有沒有什麼方法可以在JQuery中進行設置?
什麼是'--bgc'設置變量? –
@AnujKumar閱讀標題 –
@AnujKumar,這是一個CSS變量,請參閱後添加的CSS類。 – Jai