부트 스트랩을 사용하여 웹 사이트에 캐 러셀을 표시하고 슬라이드 당 여러 항목을 this example 다음에 표시합니다. 정적 이미지 사용은 완벽하게 잘 작동하며 결과에 대해 매우 만족합니다 (예 : this jsFiddle, ). 부 프레임의 미디어 쿼리로 인해 이상한 효과가 발생하지 않도록 디스플레이 프레임이 충분히 큰지 확인하십시오 (나중에을 처리합니다).슬라이드 당 여러 항목이있는 부트 스트랩 회전 목마 및 AngularJS
그러나 이제는 변수에서 회전식 슬라이드의 내용을 정의하고 ng-repeat
인 AngularJS로 바인딩하고 싶습니다. 그것이 문제가되는 곳입니다. 데이터는 올바르게 바인딩되지만 "활성"항목으로 간주되는 이미지 만 표시됩니다. 나는 그것이 이해가된다고 이해하지만 정적으로 정의 된 이미지로는 그렇게 행동하지 않았습니다. 내 버그를 보려면 this jsFiddle을 참조하십시오.
- 표시 모든 항목을 설정하고 오버 플로우 : 대신 클래스 COL-MD-4 를 사용
- 변경 항목 크기 % (33)에 모든 것을 표시 숨겨진,
HTML
<div class="carousel-started-themes" style="height:150px; width:700px;">
<div class="carousel slide" id="myCarousel">
<div class="carousel-inner">
<div class="item" ng-class="{active:!$index}" ng-repeat="img in image">
<div class="col-md-4"><a href="#"><img ng-src="{{img}}" class="img-responsive"></a>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev" style="z-index:10000;"><i class="glyphicon glyphicon-chevron-left"></i></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next" style="z-index:10000;"><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
</div>
JS
function MyCtrl($scope) {
$scope.image =["https://wallpaperscraft.com/image/minimalism_sky_clouds_sun_mountains_lake_landscape_95458_1600x900.jpg", "https://wallpaperscraft.com/image/clouds_milky_way_eclipse_light_68883_1600x900.jpg", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSl5bsNT-Qtm0tfbydXFMuFCG27Kug6D5Z3hrgitIQqQq22Da95Ig", "https://wallpaper.wiki/wp-content/uploads/2017/05/Photos-1600x900-Wallpapers-HD.jpg", "https://wallpaperscraft.com/image/torzhok_tver_region_evening_sunset_river_reflection_autumn_russia_58028_1600x900.jpg", "https://wallpaper.wiki/wp-content/uploads/2017/04/wallpaper.wiki-1600x900-HD-Image-PIC-WPD0014727.jpg"];
}
$('#myCarousel').carousel({
interval: false
});
$('.carousel .item').each(function() {
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
if (next.next().length > 0) {
next.next().children(':first-child').clone().appendTo($(this));
} else {
$(this).siblings(':first').children(':first-child').clone().appendTo($(this));
}
});
무슨 뜻인지 잘 모르겠지만, 내가 "보여 주거나 숨기지"않기 때문에 항목의 활성 상태는 부트 스트랩의 컨베이어에 고유합니다. 수동으로 모든 것을 표시하고 오버 플로우를 시도했습니다 : 숨김; 하지만 그 행동은 불행히도 거의 같았습니다. – Driblou