I have this code, what am I trying to do is to make "fade-In fade-Out" effect off the text, while every time it will do fadeIn fadeOut its will replace the text (shown on p id="string") with the next array value but its show the last value every time (Name 3 - Message 3).
the html code below:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
$(document).ready(function(){
var str = $("#string").text().split(' + ');
setInterval(function(){
s++;
for (var s = 0; s < str.length; s++) {
var string = str[s];
$("#string").html(string);
$("#string").fadeIn(500);
$("#string").fadeOut(3000);
}
}, 6000);
});
</script>
</head>
<body>
<p id="string" style="display:none;">Name 1 - Message 1 + Name 2 - Message 2 + Name 3 - Message 3</p>
</body>
</html>
Thanks you.