How do I make the typing effect when the page is scrolling down? I use this code for the start of typing:
var typed = new Typed(".class", {
strings: ["My text."],
typeSpeed: 40,
});
How do I make the typing effect when the page is scrolling down? I use this code for the start of typing:
var typed = new Typed(".class", {
strings: ["My text."],
typeSpeed: 40,
});
Considering that you need to detect scroll down event just to start the typing. You can include shabdawali js library in your code and detect for scroll down event to play pause typing effect.
var typeWriter = shabdawali(el, {
lines : ["sentence 1", "sentence 2"],
});
var lastScrollTop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if (st > lastScrollTop){
// downscroll code
typeWriter.start();
} else {
// upscroll code
typeWriter.pause();
}
lastScrollTop = st;
});
Disclaimer: I'm the author of this plugin.