我試圖讓Bootstrap傳送帶延遲加載。看起來這應該是直接的,但我甚至沒有任何錯誤在這裏排除故障。 JS:Bootstrap傳送帶延遲加載
<script type="text/javascript">
$('#bigCarousel').on("slid", function() {
// load the next image after the current one slid
var $nextImage = $('.active.item', this).next('.item').find('img');
$nextImage.attr('src', $nextImage.data('lazy-load-src'));
});
</script>
然後HTML:
<div id="bigCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<img src="assets/bigimage1.jpg" class="img-big">
</div>
<div class="item">
<img data-lazy-load-src="assets/menu-header2.jpg" class="img-big">
</div>
</div>
</div>
螢火蟲或其他任何東西沒有JS錯誤,我可以計算出,但我的圖片只是不加載。也許在這裏的東西太簡單......
僅供參考:引導程序3上的事件現在是'sliding.bs.carousel',例如。 $('#myCarousel')。on(「slidress.bs.carousel」,function(){...' –
[懶惰加載不能在bootstrap carousel中工作]的可能重複(http://stackoverflow.com/questions/27675968/lazy-load-not-work-in-bootstrap-carousel) – cmeeren