這是關係到我的其他職位,但它是一個不同的場景。jquery懸停的時間延遲顯示圖像下一個
當我將鼠標懸停在框上時,我想要顯示圖像2秒鐘,然後在2秒後顯示下一張圖像。當他們徘徊的時候,我希望他們都消失(沒有淡入或了slideDown等)
// html
<style type="text/css">
#date_1 img{display:none}
</style>
<div id="date_1">
<img src="2secondanimation.gif" id="magicimage_1" />
<img src="fixedimage.jpg" id="magicimage_1_fixed" />
</div>
和JS:
// jquery (UPDATED CODE)
$("#date_1").hover(function() {
// show image for 2 seconds
$("#magicimage_1").show(2000);
$("#magicimage_1_fixed").show();
}, function() {
// remove both above classes
$("#magicimage_1").hide();
$("#magicimage_1_fixed").hide();
});
你已經用jQuery標記了你的問題,但是你並沒有在你的代碼中好好利用它。像document.getElementById這樣的東西在jQuery中有相同的地方。 –
,因爲我不知道顯示隱藏和取消隱藏的命令,我只知道顯示項目的slideDown和fadeIn。 – TheBlackBenzKid
@TheBlackBenzKid'$('#myId')。show()'和'$('#anotherId')。hide()' – Petah