我有轮播,width=300px
我height=300px
想显示模态并克隆所有轮播 dom 元素以查看它更大的内容,
每件事都按照我的意愿复制。
但是在单击下一个上一个按钮时,旧的轮播移动而不是模态中的那个我也改变id
了新的轮播和href
在新的轮播内部,但是仍然新的轮播在单击“下一个/上一个或指示器”时没有滚动
$('#oldCarousel .item img').click(function(){
var carousel = $(this).parents('#oldCarousel');
carousel.attr('id','NewCarousel');
carousel.find('a[href="#oldCarousel"]').attr('href','#NewCarousel');
$('#myModal .modal-dialog').html(carousel.clone());
//$('#myModal .modal-content,#myModal .item,#myModal .modal-dialog').css({'width':'95%','height':'95%','max-height':'95%'});
$('#myModal .modal-dialog').css('padding','0px');
$('#myModal').modal('show');
$('#NewCarousel').carousel().carousel(0);
});
这是 jsfiddle 链接:https ://jsfiddle.net/yo0gxtd9/