我有以下的html:mousoever和設置背景色
<img class="img-polaroid img-hover" src="/images/147/09e65aac97caf00c5414593719d0e1b4-medium.jpg?1376027188" background-color="yellow">
和CSS
.img-hover:hover{
background-color: $green-highlight-1;
cursor: pointer;
}
,想轉換爲jQuery的,使我們擁有了顏色更多的控制權(和動畫它)。像這樣:
$('.img-hover').on('mouseover', function(){
console.log("here i am in img-hover");
$(this).attr('background-color','yellow');
});
但這不工作(console.log工程)。我該如何設置背景顏色?
啊,是的,THX ....很長一段時間。必須等待幾分鐘 – timpone