首先歡迎#1,作爲一個新的用戶,請閱讀本指南所以你可以要求更好,得到更好,更快的答案:
https://stackoverflow.com/help/how-to-ask
請避免在註釋代碼。如果有人要求您提供其他代碼,請將其包含在問題中。
現在的答案:
的問題就是,你沒有爲$提供jQuery的()命令工作。 「alturl.com/bcfhv」不正確。
這裏,把這個文件,它的工作:
<html>
<body>
<style>
div{
position:relative;
width:714px;
height:420;
overflow:hidden;
}
span {
position:absolute;
top:0px;
left:-0px;
}
</style>
<div>
<img src="http://berger.co.rs/test/img/mouseover.png" width="714" height="421"/>
<span>
<img src="http://berger.co.rs/test/img/active.png" width="714" height="421"/>
</span>
</div>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(document).ready(function() {
alert('ok')
$("div").hover(function() {
$("span").fadeIn();
}, function() {
$("span").fadeOut();
});
})
</script>
</body>
</html>
還是看它的工作here
請重新制定...你的問題是非常混亂 –
請看看示例站點。有兩個圖像在另一個之上。我只需要圖像1(活動圖像)淡出,圖像2淡入圖像1的位置。當前情況是:圖像2落後於圖像1,鼠標懸停圖像1淡出,圖像2剛剛停留在那裏。在mouseOut圖像1上再次淡入,但圖像2根本不消失。我想要相同的效果,只有圖像2淡出鼠標。 – vlada
我有。仍然令人困惑。 –