2012-03-16 14 views
0

私、あなたがそれを置く後の画像を育てるために、次のコードを持っている:jqueryのアニメーションを()を呼び出した後にカーソルを移動する方法

$(".myImage").hover(function() { 
      $(this).find('img').stop() /* Add class of "hover", then stop animation queue buildup*/ 
        .animate({ 
         width: '560px', /* Set new width */ 
         height: '174px', /* Set new height */ 
         padding: '20px' 
        }, 200); /* this value of "200" is the speed of how fast/slow this hover animates */ 
     }, function() { 
      $(this).find('img').stop() /* Remove the "hover" class , then stop animation queue buildup*/ 
       .animate({ 
        width: '140px', /* Set width back to default */ 
        height: '44px', /* Set height back to default */ 
        padding: '5px' 
       }, 400); 
     }); 

しかし問題は、画像が大きくなると、それは(別の画像の後ろに表示されることですは、アイテムの左側にある背景画像です)。 。この画像をかけて見せている他の画像上のCSSは次のとおりです。

.otherImage { 
background: url("/Content/Images/main1.png") repeat scroll 0 0 transparent; 
display: block; 
height: 506px; 
margin-left: auto; 
margin-right: auto; 
margin-top: 30px; 
position: relative; 
width: 527px; 
z-index: 0; 

}

どのように私はこのような背景の画像上にカーソルを移動するアニメーション呼び出している画像を得ることができますか?ここ

は(放火犯からコピー)アニメーション化するために呼び出される画像の元のCSS

element.style { 
display: inline-block; 
height: 44px; 
left: 0; 
margin-left: 0; 
margin-top: 0; 
padding: 5px; 
top: 0; 
width: 140px; 

}

.myImage img { 
height: 44px; 
width: 140px; 
z-index: 999; 

}

a img { 
border: medium none; 

}

答えて

1

ありますオブジェクトposition: absoluteがアニメーション化されている場合は、z-indexを他のオブジェクトよりも高い値に設定すると上に表示されます。

position: absoluteでない場合は、その2つのオブジェクトの関連するHTMLマークアップとすべてのCSSスタイリングを確認して、オプションが何であるかを知る必要があります。

+0

アニメーションを呼び出す元の画像のCSSで質問を更新しました – leora

+0

@leora - なぜ1つの要素が別の要素の上にあるのかを理解するには、関連するHTMLを参照する必要があります。 'height'、' width'、 'padding'のアニメーションだけで、他の値は変更されていません。アニメーションに「left」、「top」、「marginTop」、「marginLeft」を入れていないのはなぜですか? – jfriend00

+0

あなたは正しいです、私は左、上など必要はありません。 。私はそれらを削除したが、問題はまだ存在する。あなたは何を見る必要がありますか? – leora

関連する問題