我試圖創建一個簡單的效果作爲一個練習,基本上我想要的圖像時,我在它懸停改變和恢復時,我的鼠標從將無法正常工作?
<!DOCTYPE html>
<html>
<head>
<title>Change pics on event</title>
<meta charset = "utf-8">
<script src = "jsf/jquery-1.8.js"></script>
<link rel = "stylesheet" href = "talkpics.css">
</head>
<body>
<div id = "pic">
<img id = "sk" src = "tpi/skutch.jpg">
<div id = "speech">
<img src = "tpi/speech5.png">
</div>
</div>
<script>
$(document).ready(function(){
$("#sk").hover(function(){
$(this).attr("src","tpi/skutch2.jpg");
}, function(){
$(this).attr("src", "tpi/skutch.jpg");
}
});
});
var sb = new Array();
sb[0] = 'tpi/speech1.png';
sb[1] = 'tpi/speech2.png';
sb[2] = 'tpi/speech3.png';
sb[3] = 'tpi/speech4.png';
sb[4] = 'tpi/speech5.png';
</script>
</body>
</html>
數組是事物的一部分一樣,我要添加後來這是一個隨機的png講話泡泡..基本上我想讓圖像隨着隨機講話泡泡改變。但現在我的問題是要改變骷髏圖像。我已經在網上關注了tutes,並且已經給出了例子給出的代碼,但它不能用於skutch.jpg上的圖像。我不確定爲什麼任何幫助都很棒。
*{
padding:0px;
margin:0px;
border:none;
}
#pic{
height:500px;
width:500px;
margin-top:100px;
margin-left:auto;
margin-right:auto;
}
#sk{
position:relative;
}
#speech{
position:relative;
top:-450px;
left:-20px;
}
對我來說很不錯。請把它撥弄。 – gillyspy 2013-05-05 07:44:55