我只是將圖像製作成從左到右和從右到左的動畫?爲什麼這不起作用?我用一段完美的段落做了這個。但是有一張圖片它不起作用!我的jQuery動畫方法有什麼問題?
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$(".btn1").click(function(){
$("img").animate({left:"100px"}, 'slow');
});
$(".btn2").click(function(){
$("img").animate({left:"0"}, 'slow');
});
});
</script>
</head>
<body>
<button class="btn1">Animate</button>
<button class="btn2">Reset</button>
<br />
<br />
<br />
<br />
<img src="https://google.com/favicon.ico" />
</body>
</html>
設置左側和頂部屬性將不會工作,除非圖像有位置。 – adeneo
http://jsfiddle.net/9pfY7/ – adeneo