我正在使用此jQuery选择下一个列表元素并克隆类.slide-title
,然后将其附加到另一个类。
$('li:visible').next('.slide-title').clone().appendTo('.feat_next');
这是HTML和jsfiddle如果我从.next()
函数中删除选择器,它将克隆下一个列表元素并将其追加。那么为什么不找到.slide-title
类?
由于
<ul id="slider" style="position: relative;">
<li style="position: absolute; top: 0px; left: 0px; display: block; z-index: 4; opacity: 1;">
<div class="content_left">
<p class="slide-date">July 2, 2012</p>
<h2><a class="slide-title" href="#">3333333333</a></h2>asdfasfasfasdfasdfasdfasdfasfdasfdasfdasfd
<p class="post-byline">by admin</p>
</div>
<div class="img_right"><a href="#"><img src="#"></a>
</div>
</li>
<li style="position: absolute; top: 0px; left: 0px; display: none; z-index: 2; opacity: 0;">
<div class="content_left">
<p class="slide-date">April 1, 2013</p>
<h2><a class="slide-title" href="#">asdfasdfasdf</a></h2>asdfasfasdfasdfasdf
<p class="post-byline">by admin</p>
</div>
<div class="img_right"><a href="#"><img src="#"></a>
</div>
</li>
<li style="position: absolute; top: 0px; left: 0px; display: none; z-index: 1; opacity: 0;">
<div class="content_left">
<p class="slide-date">April 2, 2013</p>
<h2><a class="slide-title" href="#">223234234</a></h2>asdfasfdasfasfasfasdfasdf
<p class="post-byline">by admin</p>
</div>
<div class="img_right"><a href="#"><img src="#"></a>
</div>
</li>
</ul>
<div class="feat_next"><a href="#"></a></div>
<div class="feat_prev"><a href="#"></a></div>