Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<p>Blah blah blah <span id="rotate"></span> blah blah blah </p>
</body>
</html>
 
$(function () {
    function rotate(spanid, arrayOfWords) {
        var $mySpan = $("#" + spanid);
        (function repeatRotate(index) {
            var i = index || 0;
  $mySpan.text(arrayOfWords[i]).fadeIn(2000).delay(2000).fadeOut(2000, function () {
                i = (i === arrayOfWords.length - 1) ? 0 : ++i;
                repeatRotate(i);
            });
        })();
    }
    rotate("rotate", ["word1", "word2", "word3"]);
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers