Image captions appearing on scroll
-
Hi,
I have a simple one page site and wondered if there's a simple way to make image captions fade in on a scroll – perhaps at a fixed point (%) of the page height? Any pointers would be really helpful.
Many thanks in advance,
Norman -
so
if you have a caption for an image, it has the class ".caption"
so you'd need to use css to set the opacity to 0,
in lay options -> custom css & htmlthen use javascript:
use intersection observer
https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
or window scroll event with getBoundingClientRect https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRecttogether with window.laytheme.on('newpageshown', function(){
})https://laytheme.com/documentation/custom-javascript.html#newpage-events
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