当 'top' 是 where 字符串时,使用 clone(rue, false).inject('myList', 'top') 会反转项目顺序。必须有一种优雅的排序方式吗?我的方法错了吗?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-gb" xml:lang="en-gb">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/moo.1.4.5/core.js"></script>
<script type="text/javascript">
window.addEvent('domready', function () {
$('myList').getChildren().each( function (el, i) {
el.clone(true, false).addClass('clone').inject('myList', 'top');
el.clone(true, false).addClass('clone').inject('myList', 'bottom');
}) ;
});
</script>
</head>
<body>
<ul id="myList">
<li><p>Slide 1</p></li>
<li><p>Slide 2</p></li>
<li><p>Slide 3</p></li>
<li><p>Slide 4</p></li>
<li><p>Slide 5</p></li>
</ul>
</body>
</html>
返回
<ul id="myList">
<li class="clone"><p>Slide 3</p></li>
<li class="clone"><p>Slide 2</p></li>
<li class="clone"><p>Slide 1</p></li>
<li><p>Slide 1</p></li>
<li><p>Slide 2</p></li>
<li><p>Slide 3</p></li>
<li class="clone"><p>Slide 1</p></li>
<li class="clone"><p>Slide 2</p></li>
<li class="clone"><p>Slide 3</p></li>
</ul>