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.
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it
Online Users
Forgot your key, lost your files, need a previous Lay Theme or Addon version?
Go to www.laykeymanager.com