Change Text while scrolling
-
I have different videos among each other and would like to show the caption at a certain scrollposition. Is that possible? How can I implent that?
I already have kind of a code snipetconst bodyTag = document.querySelector("body") const sections = document.querySelectorAll("section") const clientTag = document.querySelector("div.client") const headerTag = document.querySelector("header") document.addEventListener("scroll", function () { const pixels = window.pageYOffset sections.forEach(section => { if (section.offsetTop - 60 <= pixels) { const title = document.querySelector("div.title") // clientTag.innerHTML = section.getAttribute("data-client") clientTag.innerHTML = section.getAttribute("data-client") } }) }) -
Waypoints does this...
http://imakewebthings.com/waypoints/Ex in LAY, add/remove a CSS class on the 'index' : https://kiti.ca/kitty-care
Doesn't work as well on mobile... working on it.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login