0
私がdivをドラッグすると、画像のタイトルが表示され、日付が10px移動します。私のコードでは、タイトルだけを表示しますが、日付部分は移動しません。 2つのjqueryアニメーションアクションをすべてうまく実行させる方法Thax。2つのjQueryアニメーションアクションを結合するには?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> </title>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$(function() {
$('.image').each(function() {
$(this).hover(
function() {
$('.title', this).animate({ opacity: 1 })
},
function() {
$('.title', this).stop().animate({ opacity: 0 });
},
function() {
$('.date', this).animate({ top: '+=10' })
},
function() {
$('.date', this).stop().animate({ top: '-=10' });
})
});
});
</script>
</head>
<body>
<div class="image"><img src="img1.jpg"><p class="title">test1</p><p class="date">2010</p></div>
</body>
</html>
グレート、正しい方法は次のように記述する必要があります。 –
これは機能すると言っていますか?もしそうなら、答えを受け入れてください! – Eric