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
I'm trying to write a sentence that has a different word in it each time it's written. The problem is that the callback function doesn't execute if the loop option is set to true, so it just re-writes the same sentence over and over. I've tested it and it seems that when the loop option is set to false the callback works fine.
Is there a better way of achieving this effect?
The text was updated successfully, but these errors were encountered:
Sorry for the troubles you're having with this. The callback only executes if the loop option is set to false, since it was only designed to execute after all of the strings have been finally typed. I may consider releasing a patch to have that execute after each set of strings, though.
Additionally, when re-looping over the strings, TypeIt won't look at the strings option again; it will just re-use what's already been cached. So, to get your effect going, I'd construct the strings before passing them into TypeIt, like this:
varwords=["developer","designer","problem solver","hard worker","nice guy!"];varsentences=[];for(vari=0;i<words.length;i++){sentences.push('I’m Geoff and I’m a '+words[i]);}$("#about h3").typeIt({strings: sentences,startDelay: 1500,speed: 100,loop: true,autoStart: false});
This will type out all of those strings, and because loop is set to true, delete the entire set (unless breakLines = false) and retype them.
I hope this helps! Let me know if you have more questions.
I have some code:
'use strict';
var words = ["developer", "designer", "problem solver", "hard worker", "nice guy!"];
var index = 0;
$("#about h3").typeIt({
strings: "I’m Geoff and I’m a " + words[index],
startDelay: 1500,
speed: 100,
loop: true,
autoStart: false,
callback: function() {
index++;
}
});
I'm trying to write a sentence that has a different word in it each time it's written. The problem is that the callback function doesn't execute if the loop option is set to true, so it just re-writes the same sentence over and over. I've tested it and it seems that when the loop option is set to false the callback works fine.
Is there a better way of achieving this effect?
The text was updated successfully, but these errors were encountered: