Right, so here is a plunkr with corrected indentation: http://plnkr.co/edit/IdvC8YIgQBF6wuDAzbxU
To get the next image, assuming that you want to use jQuery and that the current image is the one with the class 'active':
$(document).ready(function () {
function getNextAndPrev() {
var activeSlide = $('.active');
var nextImage, prevImage;
if (activeSlide.next().length) {
nextImage = activeSlide.next().find('img').attr('src')
} else {
nextImage = $('.carousel-inner').children().first().find('img').attr('src');
}
if (activeSlide.prev().length) {
prevImage = activeSlide.prev().find('img').attr('src')
} else {
prevImage = $('.carousel-inner').children().last().find('img').attr('src');
}
$('.previmage').attr('src', prevImage);
$('.nextimage').attr('src', nextImage);
}
getNextAndPrev();
$('.next, .prev').on('click', getNextAndPrev);
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…