Yes, but exactly how would depend upon what the rest of your code is like. While setting up you can do:
Code:
<script type="text/javascript">
(function(){
TypingText.instances = [];
var getClass = function(c){
if(document.getElementsByClassName) return document.getElementsByClassName(c);
var els = document.all || document.getElementsByTagName('*'), ar = [],
re = new RegExp('\\b' + c + '\\b');
for(var i = 0; i < els.length; ++i)
if(re.test(els[i].className))
ar[ar.length] = els[i];
return ar;
};
//Define typing for the typer class:
for(var c = getClass("typer"), i = 0; i < c.length; ++i)
TypingText.instances[i] = new TypingText(c[i]);
//Type out all:
//TypingText.runAll();
})();
</script>
Now nothing will run onload of the page. But each instance will have a reference:
Code:
TypingText.instances[0].run();
will run the first instance on the page.
Code:
TypingText.instances[1].run();
will run the second instance on the page, and so on.
If you can integrate that into your jQuery code, you are all set. If you want more help:
Please post a link to the page on your site that contains the problematic code so we can check it out.
Bookmarks