这是我的代码示例:
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Effects - Effect demo</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="test.js" type="text/javascript"></script>
</head>
<body>
<div class="toggler">
<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a>
<div id="add">
</div>
<div id="oldli" class="newclass">
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</div>
</div>
</body>
</html>
jQuery(test.js):
$(function() {
// run the currently selected effect
function runEffect() {
// get effect type from
var selectedEffect = 'slide';
// most effect types need no options passed by default
var options = {};
// run the effect
var temp = '<div class=""><div>1</div><div>2</div><div>3</div><div>4</div></div>'
$(temp).insertAfter('div#add').effect({effect:'slide',direction:'up',queue:false});
};
// callback function to bring a hidden box back
function callback() {
};
// set effect from select menu value
$( "#button" ).click(function() {
runEffect();
return false;
});
});
现在,当您按下运行效果时,新 div 会添加幻灯片效果,但旧数据仅在插入后出现在他的新位置,我希望旧数据以相同的幻灯片效果下推并与幻灯片同步新插入数据的效果并继续对插入的每个新数据执行此操作