怎么解决再次单击回到原来的位置?
$(document).ready(function(){
$('.car').hover(function(){
$('.car').stop(true)
.animate({top:'0px'},{duration:1000})
},function(){
$('.car').stop(true)
.animate({top:'500px'},{duration:1000})
})
});$(function() {
$('.car').click(function() {
if ($('.car').offset().top == 0) {
$('.car').animate({ top: '500px' }, { duration: 600 });
} else{
$('.car').animate({ top: '0px' }, { duration: 600 });
}
});
});