我試圖在h1上使用jQuery懸停的背景顏色,因爲IE,但沒有任何反應。我檢查了我的JavaScript來源,這兩個鏈接是正確的。我已經嘗試過其他屬性(高度,頂端...),在其他divs,但沒有發生過。我加入了我認爲相關的代碼部分。有人看到有什麼問題嗎?jQuery的動畫沒有做任何事情
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost/WP-remivincent/wp-content/themes/data.vortex/js/ColorAnimation/jquery.animate-colors-min.js"></script>
<script>
$('.infos-une').hover(
function(){
$(this).animate({backgroundColor: 'rgba(190,52,19,0.8)'});
},
function(){}
);
</script>
</head>
<style> // In my style.css file
.infos-une { // it’s a <h1>
background-color: rgba(0,0,0,0.6);
color: #fff;
display: block;
height: 130px;
padding: 20px;
position: absolute;
top: 311px;
width: 301px;
}
</style>
<section>
<div class="articles-une-container">
<div class="articles-une">
<div>
<a href="http://localhost/WP-remivincent/article-title/">
<img width="341" height="341" src="illustration.jpg" class="attachment-post-thumbnail wp-post-image" alt="illu-3">
<h1 class="infos-une gd rokkit">Article title</h1>
</a>
</div>
</div>
</div>
</section>
這總是可以做到用'$(函數(){/ *代碼* /})短; ' – Biketire
哦,這是尷尬。對不起,我是一個JavaScript和jQuery初學者... 非常感謝,但這一直在竊聽一段時間! – aeon