我有一个bootstrap轮播,我实现了两个按钮,一个用于上传图像,另一个用于删除当前图像在旋转木马中显示。我不知道如何删除活动元素。你能帮我解决一下按钮的代码吗?非常感谢
<div class="carousel slide" id="carousel-1">
<ol class="carousel-indicators">
{{#each contents}}
<li data-slide-to="{{@index}}" data-target="#carousel-1" class="{{#unless @index}}active{{/unless}}"></li>
{{/each}}
<li data-slide-to="2" data-target="#carousel-1" class="customized-indicator">
<i class="fa fa-plus-circle"></i><span> Add new</span>
</li>
</ol>
<div class="carousel-inner">
{{#each contents}}
{{#carousel_active this}}
<div class="item {{#if value.active}}active{{/if}}">
<img alt="{{value.title.title}}" src="{{value.image.url}}">
<div class="overlay">
<button class="btn carousel-button">
<i class="fa fa-exchange"></i> Replace Image
</button>
<button class="btn carousel-button">
<i class="fa fa-times-circle"></i> Remove Image
</button>
</div>
</div>
{{/carousel_active}}
{{/each}}
</div>
<a class="left carousel-control" href="#carousel-1" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#carousel-1" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
答案 0 :(得分:0)
类似的东西:
$('.overlay .carousel-button:last-child').on('click', function(){
$('.item.active img').remove()
});