//한글자 한글자 타이핑 효과 주기
(function () {
var app;
$(document).ready(function () {
return app.init();
});
app = {
text: 'If you can imagine it, you can create it. If you can dream it, you can become it.',
index: 0,
chars: 0,
speed: 100,
container: '.selector',
init: function () {
this.chars = this.text.length;
return this.write();
},
write: function () {
$(this.container).append(this.text[this.index]);
if (this.index < this.chars) {
this.index++;
return window.setTimeout(function () {
return app.write();
}, this.speed);
}
}
};
}.call(this));
댓글
댓글 쓰기