You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FOA, thanks for your great plugin. I think it should be usefull to add the ability to pass at least one parameter (speed?) and to call a callback function. So I've modified one of your text effects like this:
$.fn.typewriter = function(speed, callback) {
this.each(function() {
var $ele = $(this), str = $ele.text(), progress = 0;
$ele.text('');
var timer = setInterval(function() {
$ele.text(str.substring(0, progress++) + (progress & 1 ? '_' : ''));
if (progress >= str.length){
clearInterval(timer);
if (typeof callback == 'function') { // make sure it is a function
callback.call(this); // brings the scope to the callback
}
}
}, speed);
});
return this;
};
Bye, Daniele.
The text was updated successfully, but these errors were encountered:
FOA, thanks for your great plugin. I think it should be usefull to add the ability to pass at least one parameter (speed?) and to call a callback function. So I've modified one of your text effects like this:
$.fn.typewriter = function(speed, callback) {$ele = $ (this), str = $ele.text(), progress = 0;
this.each(function() {
var
$ele.text('');
var timer = setInterval(function() {
$ele.text(str.substring(0, progress++) + (progress & 1 ? '_' : ''));
if (progress >= str.length){
clearInterval(timer);
if (typeof callback == 'function') { // make sure it is a function
callback.call(this); // brings the scope to the callback
}
}
}, speed);
});
return this;
};
Bye, Daniele.
The text was updated successfully, but these errors were encountered: