Unfortunately I get 3 warnings at jslint. Could someone please help?
I already tried a lot, but didn't get it yet.
Here's a jsfiddle: http://jsfiddle.net/KYjF9/21/
JSlint options:
/*jslint browser: true indent: 2 */ /*global $ jQuery alert*/
JavaScript:
var Typing = function (el, toType, period) {
"use strict";
this.toType = toType;
this.el = el;
this.loopNum = 0;
this.period = parseInt(period, 10) || 2000;
this.txt = '';
this.tick();
this.isDeleting = false;
};
Typing.prototype.tick = function () {
"use strict";
var fullTxt = this.toType[this.loopNum % this.toType.length];
if (this.isDeleting) {
this.txt = fullTxt.substring(0, this.txt.length - 1);
} else {
this.txt = fullTxt.substring(0, this.txt.length + 1);
}
$(this.el).html('<span class="wrap">' + this.txt + '</span>');
var delta = 300 - Math.random() * 100;
if (this.isDeleting) { delta /= 2; }
if (!this.isDeleting && this.txt === fullTxt) {
delta = this.period;
this.isDeleting = true;
} else if (this.isDeleting && this.txt === '') {
this.isDeleting = false;
this.loopNum = this.loopNum + 1;
delta = 500;
}
setTimeout(this.tick.bind(this), delta);
};
var data = {
"text": {
"list": ["hello", "hallo", "hola", "what", "ever"],
"period": "3000"
}
};
$(document).ready(function () {
"use strict";
var toType = data.text.list;
var period = data.text.period;
$(".js").each(function () {
if (toType) {
new Typing(this, toType, period);
}
});
});