- This topic has 7 replies, 1 voice, and was last updated 4 years ago by .
Viewing 8 posts - 1 through 8 (of 8 total)
Viewing 8 posts - 1 through 8 (of 8 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hello, I just saw an animation effect of images on this site: https://fantastech.co/psd-to-wordpress/
If you load the page and scroll down the images gradually appear and are not loaded before hand. How can I achieve this with pure CSS and without using JavaScript?
Thanks in advance.
I would say this is impossible with CSS only. Why wouldn’t you want to use javascript for this?
It’s called ‘Lazy Loading’. If you use WordPress there are some free plugins in their repository but there are also some for non WP sites too.
I did some research and see that we can give that use transform animations the fade effect. But have not found exact code for that.
@Secur3, the site I’m building is static HTML/CSS site. The client wanted it as a normal fast loading landing page.
@JeroenR, as I’m not using any Javascript libraries I wanted to avoid using it and looking for CSS approach. If there isn’t one, I’ll have to use some kind of JS library. Do you know of any good one?
@mrdeveloper There are resources for non-WP sites too. There are about 5 listed on here:
https://www.pcrepairmansblog.com/lazy-loading-libraries-for-html-css-websites
but there are a few others available if you search. I have used Lazysizes without any problems and it’s quite lightweight.
I have never seen a CSS only approach that actually doesn’t load the image. Be careful, some CSS code may load the images but simply turn off visibility which won’t help.
I would say this is impossible with CSS only. Why wouldn’t you want to use javascript for this?
@Everyone, I actually ended up using Javascript to do this. Trying to search ways to do it without JS and in pure CSS was an unnecessary waste of time.
For those who read this in future, I ended up using : https://github.com/aFarkas/lazysizes to implement lazy load as suggested in the link shared by @Secur3.
Thanks!