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
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