複数の画像があります。各画像にマウスオーバーすると別の画像に変わり、マウスアウトすると前の画像に戻ります。問題は、このプロセスをすべての画像で迅速に実行すると、各画像はホバー画像にそのまま残りますが、前の画像には戻らないことです。しかし、ゆっくりとこれを行うと、効果と機能が正しく機能します。次のコード スニペットは、2 つの画像に対してのみ提供しています。これから私を助けてください。私の下手な英語で申し訳ありません。
HTML 部分
<div style="float:left;">
<a class="dialog-link" href="#" >
<img src="images/twitter.png" width="126" height="78" border="0" class="twitter_h"/>
</a>
</div>
<div style="float:left; margin-left:83px;">
<a class="dialog-link" href="#" target="_blank">
<img src="images/linkedin.png" width="232" height="78" border="0" class="linkedin_h"/></a>
</div>
Jクエリ部分
<script>
$(function(){
var link_open=false;
var openGif_t = $(".twitter_h").attr("src");
var closedGif_t = openGif_t.replace("twitter.png", "follow1.png");
var openGif_l = $(".linkedin_h").attr("src");
var closedGif_l = openGif_l.replace("linkedin.png", "connect1.png");
$(".twitter_h")
.mouseenter(function() {
$(this).fadeOut(function(){
$(this).attr("src", closedGif_t);
$(this).fadeIn(150);
});
})
.mouseleave(function() {
$(this).fadeOut(function(){
$(this).attr("src", openGif_t);
$(this).fadeIn(150);
});
});
$(".linkedin_h")
.mouseenter(function() {
//alert(closedGif)
$(this).fadeOut(function(){
$(this).attr("src", closedGif_l);
$(this).fadeIn(150);
});
})
.mouseleave(function() {
// alert($(this).attr("src"));
$(this).fadeOut(function(){
$(this).attr("src", openGif_l);
$(this).fadeIn(150);
});
});
});