I am creating a landing page in which I am adding JS code with a function of typeEffect that function if I recognize it and execute it correctly. But when I add an interval for that function to execute it every so often, it ignores the time interval. I have reviewed the JS code with the company development team and in theory it is correct. I do not know if I have to see something with HubSpot. Can you help me review this issue, please? I add the JS code that I am using:
function typeEffect() {
var speed = 75;
var delay = $(‘h2’).text().length * speed + speed;
var text = $(‘h2’).text();
$(‘h2’).html(‘’);
var i = 0;
var timer = setInterval(function() {
if (i < text.length) {
$(‘h2’).append(text.charAt(i));
i++;
} else {
clearInterval(timer);
}
}, speed);
}
$( document ).ready(function() {
typeEffect();
setInterval (typeEffect(), 5000);
/*setTimeout(function(){
}, delay)*/
});
And I add the link about landing:
I commented to you that the title of: “¿QUÉ ES LA NUBE?” it is where I´m attaching this JS code.
Also I attach a screenshot where I´m add the script in my template.
If you need know something else plis let know.
I remain to your comments.
Thank and Regards