$(function(){
var carouselWrap = $('#carousel-example-generic'),
typedTxtArr = [
'First Carousel Text',
'Second Carousel Text',
'Third Carousel Text'
],
typed, typedObj;
var typedFunc = function( a, b ) {
typed = new Typed(a[0], {
strings: [
typedTxtArr[ b ]
],
stringsElement: null,
typeSpeed: 70,
startDelay: 1000,
smartBackspace: false,
backSpeed: 60,
backDelay: 5000,
loop: true,
loopCount: 5,
showCursor: false,
cursorChar: "|",
attr: null,
contentType: 'html',
callback: function() {},
preStringTyped: function() {},
onStringTyped: function() {
setTimeout(function(){
carouselWrap.carousel('next');
}, 1000);
},
resetCallback: function() {},
onReset: function(self) {
}
});
}
carouselWrap.on('slid.bs.carousel', function () {
var idx =$(this).find('.active').index(),
typedObj = $('.typing').eq( idx );
typed.destroy();
typedFunc( typedObj, idx );
});
// init
typedFunc( $('.typing').eq(0), 0);
});
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<div class="item_bg"></div>
<div class="carousel-caption">
<span class="typing"></span>
</div>
</div>
<div class="item">
<div class="item_bg"></div>
<div class="carousel-caption">
<span class="typing"></span>
</div>
</div>
<div class="item">
<div class="item_bg"></div>
<div class="carousel-caption">
<span class="typing"></span>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" 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="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
ul,li {
list-style:none;
margin:0px;
padding:0px;
}
.item_bg {
background-color:#757575;
height:200px;
}
.carousel-caption {
padding-top:0px;
padding-bottom:60px;
}
#typed,#typed2,#typed3 {
font-size:25px;
color:#fff;
}
.typing {
font-size: 20px;
}
.typing::after {
content: '|';
display: inline;
-webkit-animation: blink 0.7s infinite;
-moz-animation: blink 0.7s infinite;
animation: blink 0.7s infinite;
}
.typing-cursor{
opacity: 0;
display: none;
}
@keyframes blink{
0% { opacity:1; }
50% { opacity:0; }
100% { opacity:1; }
}
@-webkit-keyframes blink{
0% { opacity:1; }
50% { opacity:0; }
100% { opacity:1; }
}
@-moz-keyframes blink{
0% { opacity:1; }
50% { opacity:0; }
100% { opacity:1; }
}
External resources loaded into this fiddle: