昨日、JavaScriptを使ったテキスト効果を探していました。私はこのフィドルを指摘されました:http: //jsfiddle.net/vCx6W/1/そしてこれはそれが投稿された場所です: https ://stackoverflow.com/questions/4074399/what-to-choose-for-typewriter-effect -in-javascript
私は同じものを使おうとしています。私は次のようにJavaScriptを追加しました:
<script type="text/javascript" src="http://code.jquery.com/
jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$.fn.teletype = function(opts) {
var $this = this,
defaults = {
animDelay: 50
},
settings = $.extend(defaults, opts);
$.each(settings.text, function(i, letter) {
setTimeout(function() {
$this.html($this.html() + letter);
}, settings.animDelay * i);
});
};
$(function() {
$('#container').teletype({
animDelay: 100,
text: 'Now is the time for all good men to come to the aid of their country...'
});
});
</script>
そしてこれはHTMLで:
<div id="container"></div>
しかし、テキストをまったく表示させることができません。私は何が間違っているのですか?