我正在开发jquery,并且尝试在动态内容上使用slideToggle,但无法将其编成幻灯片。如何使其正常工作?我会为您提供http://jsfiddle.net/P3WaC/
<li class="pull-right">
<div class="text-righ padding-right">
<div class="chart">My cart (<span class="item_cart">3</span>)</div>
<button class="btn btn-warning">CHECKOUT</button>
<input type="text" class="input-large light-panel active-tab-search" placeholder="Search rewards">
</div>
<div id="cart-info" style="display: none;">
<div id="each-2" class="shopp" style="display: none;">
<div class="label">Gift voucher</div>
<div class="shopp-price">$<span class="itempr">20</span>
</div><span>Quantity: </span><span class="shopp-quantity">2</span>
<img src="../img/erop/remove.png" class="remove">
<br class="all">
</div>
<div id="each-3" class="shopp" style="display: none;">
<div class="label">Gift voucher</div>
<div class="shopp-price">$<span class="itempr">10</span>
</div><span>Quantity: </span><span class="shopp-quantity">1</span>
<img src="../img/erop/remove.png" class="remove">
<br class="all">
</div>
</div>
$('.pull-right').on('click',function(){
alert( $('#cart-info').text());
$('#cart-info').slideToggle('slow');
});
动态内容在cart-info下。我想显示这些项目并相应地隐藏它们。
最佳答案
从display:none;
的子div上删除#cart-info
,否则它们将不会显示!
演示:http://jsfiddle.net/tymeJV/P3WaC/1/
关于javascript - 在动态内容上滑动切换,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18873807/