After deleting all slides in bootstrap carousel except one slide get the current index of slide present

After deleting all slides in bootstrap carousel except one slide get the current index of slide present

Hi,


After deleting all slides in bootstrap carousel (except one active slide). Not able to get the current index of last slide which is not deleted. How to get current index of the left over slide. i am able to delete slides using the below code but not able to get the current index after deleting a slide using the button click

the below code i have used for deleting slides.

$("button").click(function() {
  currentIndex = $('div.active').index();
  // alert(currentIndex);
  var ActiveElement = $carousel.find('.item.active');
  ActiveElement.remove();
  var NextElement = $carousel.find('.item').first();


Please helpme.....................