我有以下CSSjQuery的改變顏色的CSS:懸停
#button:hover .inner {
background-color: #9c0000;
-webkit-animation: circle 1s;
-webkit-animation-fill-mode: forwards;
-moz-animation: circle 1s;
-moz-animation-fill-mode: forwards;
animation: circle 1s;
animation-fill-mode: forwards;
}
的想法是,這將.inner
父DIV中成長填滿它。這部分工作,但我想讓人們定義一個background-color
,當我嘗試$('#button:hover .inner').css('background-color',colorChoice);
這根本不會改變它。
所以我想知道它實際上是可以改變從CSS中background-color
以上使用jQuery,如果我能夠提供這樣一個變量var colorChoice = '#ff0';
我提供了我的jsFiddle向您展示我如何想工作
感謝它徹底忘在腦後 – ngplayground 2013-05-01 10:40:01
文件並沒有提到這一點,但jQuery的遷移插件則說這「懸停」僞事件已被棄用,使用「的mouseenter mouseleave'' – 2013-05-01 10:40:11