JSFiddle - React, Tailwind, and code Playground

by Dan

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
    <li data-target="#myCarousel" data-slide-to="1"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" id="listbox" role="listbox">
    <div class="item active" data-slideType="twitter">
      <img src="https://www.walldevil.com/wallpapers/a18/backgrounds-wallpapers-chess-clean-filter-underwater-psychopulse-resolutions-krzysztof-panas-squares-blue-room.jpg" alt="...">
      <div class="carousel-caption">
        <h1>
          Twitter
        </h1>
      </div>
    </div>
    <div class="item" data-slideType="insta">
      <img src="http://www.turboservis2a.com/wp-content/uploads/2014/05/bgd.jpg" alt="...">
      <div class="carousel-caption">
        <H1>
        INSTAGRAM
        </H1>
      </div>
    </div>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
<hr />
<div>

<div class="MessageBox" id="MessageBox">
...
</div>

CSS

.item {
  height: 260px;
  width: 100%;
}
.MessageBox {
  border: 2px solid #aaf;
  padding: 10px;
  width: 100%;
}

JavaScript

var myCarousel = $("#myCarousel");
childsList = Array.prototype.slice.call( document.getElementById('listbox').children );
myOutBox = document.getElementById("MessageBox");

myCarousel.on('slide.bs.carousel', function (e) {
	myOutBox.innerHTML = "slide" + (childsList.indexOf(e.relatedTarget) + 1);
});