jQuery在指定位置插入元素动画特效,例如:eq(0)表示第1个元素后插入,可定义为变量,更加灵活。
js代码
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/jquery.magicmove.js"></script>
<script>
jQuery(function ($) {
$('button.animate1').click(function () {
$('.containers').magicMove({
easing: 'ease',
duration: 300
}, function () {
var index = $(this).children().length + 1;
var $el = $('<section>' + index + 'th</section>');
$(this).find('section').eq(0).after($el);
});
});
$('button.animate2').click(function () {
$('.containers').magicMove({
easing: 'ease',
duration: 500
}, function () {
var index = $(this).children().length + 1;
var $el = $('<section>' + index + 'th</section>');
$(this).find('section').eq(2).after($el);
});
});
$('button.animate3').click(function () {
$('.containers').magicMove({
easing: 'ease',
duration: 500
}, function () {
var index = $(this).children().length + 1;
var $el = $('<section>' + index + 'th</section>');
$(this).find('section').eq(1).after($el);
});
});
});
</script>
系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791