2014-05-05 46 views
1

我正在嘗試如何使用jquery動態更改-webkit。使用jquery動態更改webkit

我的CSS

::-webkit-scrollbar-button { 
    height: 75px; 
    width: 0; 
    -webkit-box-shadow: inset 1px 1px 2px rgba(0,0,0,0.2); 
} 

我的jQuery

 $('::-webkit-scrollbar-button').css("height",'100px'); 

回答

0

我只想動態添加腳本元素。

$('body').append('<style>::-webkit-scrollbar-button{height:75px;}</style>'); 

如果必須改變這種頻繁添加下一個,然後才能刪除最後一個,但它不完全是必要因爲最後一個會優先考慮。

var $style = $('<style id="dynamicStyle">::-webkit-scrollbar-button{height:75px;}</style>'); 
$('#dynamicStyle').remove(); 
$('body').append($style);