jQuery .click .animate向下移动,然后向上移动 [英] jQuery .click .animate to move down, then back up
本文介绍了jQuery .click .animate向下移动,然后向上移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
到目前为止,我设法做到这一点,所以它以120的增量向下移动,但我希望它上下移动,而不是上下......我希望我已经解释了这个某人将会理解。
So far I managed to make it so it moves down on a click in increments of 120, but I want it to go up and down, not down and down... I hope I've explained this so "someone" will understand.
<script>
$(document).ready(function() {
$('#footertab').click(function() {
$('#footer').animate({
bottom: '-=120'
}, 1000, function() {
// Animation complete.
});
});
});
</script>
推荐答案
如果我做得对,那你就是期待切换页脚的位置。这可以通过.toggle() - 函数来完成:
If I get this right, you're looking to toggle the position of the footer. This can be done with the .toggle()-function:
$(document).ready(function() {
$('#footertab').toggle(function() {
$('#footer').animate({
bottom: '-=120'
}, 1000);
},function() {
$('#footer').animate({
bottom: '+=120'
}, 1000);
})
});
这篇关于jQuery .click .animate向下移动,然后向上移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文