0
동일한 페이지에 3 개의 부트 스트랩 캐 러셀을 사용했습니다. 세 번째 회전 목마에서 슬라이드 이미지만으로 표시 할 텍스트를 추가했습니다. 내 세 번째 회전 목마 이것은 내 회전 목마같은 페이지에 여러 개의 회전식 캐노피가 있습니다.
// Set carousel options
$('#homepage-feature').carousel({
interval: 8000 // 8 seconds vs. default 5
});
// Set carousel options
$('#timetable-feature').carousel({
interval: 10000 // 4 seconds vs. default 5
});
$('#image-gallery-carousel').carousel({
interval: 5000
});
$('#carousel-text').html($('#slide-content-0').html());
// When the carousel slides, auto update the text
$('#image-gallery-carousel').on('slid.bs.carousel', function (e) {
var id = $('.item.active').data('slide-number');
//alert(id);
$('#carousel-text').html($('#slide-content-'+id).html());
});
모든 회전 목마는 작업에 사용한 jQuery를하지만 세 번째 회전 목마의 텍스트가 작동하지 않는 정확히 this -
같다. 3 번째 컨베이어를 추가하면 작동합니다. 내 문제는 다른 두 사람과 함께 작동하지 않는 이유입니다. 이 페이지의 3 회전 목마를 때
을 시도 잘못된
.item-active
(첫 번째 회전 목마를) 대상으로하는 의심 것입니다. 그 일. 사실 그곳에서 무슨 일이 일어 났습니까? – TNK모든 캐로 셀에는 ".item.active"클래스의 하위 항목이 있습니다. $ (". item.active")를 호출하면 jQuery는 클래스 ".item-active"가있는 모든 요소를 리턴한다. 그런 다음 var id = $ (...). data ("슬라이드 번호")를 호출하면 변수는 첫 번째 변수 만 가져옵니다 (http://jsfiddle.net/petetnt/U73bJ/ 참조). 내 코드에서는 id # image-gallery-carousel (이 함수는 $ (this))이며 http://api.jquery.com/find를 사용하여 ".item-active"요소를 찾습니다. / –