そこで、プリロードの目的でイメージ スワップを実行する新しい方法を試すために、この小さなコードを書きましたが、少し問題が発生しています。
私の問題は、パディングとテキストを含む画像のコンテナーがあることですが、ロールオーバーのアクティブ化は、コンテナーではなく、誰かが画像をロールオーバーしたときにのみ発生します。私は少し間違っているに違いありません。誰かが私を助けてくれることを願っています。まだまだ勉強中!
html は次のとおりです。
<div class="projectThumb">
<img src="/img/aeffect_button_static.gif" width="146" height="199" class="static" name="aeffect" alt="" />
<img src="/img/aeffect_button_rollover.jpg" width="146" height="199" class="rollover" name="aeffect" alt="" />
<p class="title">A.EFFECT: Film Poster</p>
</div>
ここにjqueryがあります:
$(document).ready(function(){
$(".rollover").hide();
$(".projectThumb").mouseenter(
function(){
$(this).attr(".static").hide();
},
function(){
$(this).attr(".rollover").show();
});
$(".projectThumb").mouseleave(
function(){
$(this).attr(".rollover").hide();
},
function(){
$(this).attr(".static").show();
});
});