Created
October 10, 2018 02:09
-
-
Save digisavvy/3487da5d1ef7f924daf5564e26459a78 to your computer and use it in GitHub Desktop.
Fade-in lazy loaded images while using WP Rocket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Image with 'data' attribute is hidden */ | |
| img[data-lazy-src] { | |
| /* we set the opacity to 0 */ | |
| opacity: 0; | |
| } | |
| /* Image without 'data' attribute is (or becomes) visible */ | |
| img.lazyloaded { | |
| /* prepare the future animation */ | |
| -webkit-transition: opacity .5s linear 0.2s; | |
| -moz-transition: opacity .5s linear 0.2s; | |
| transition: opacity .5s linear 0.2s; | |
| /* we set the opacity to 1 to do the magic */ | |
| opacity: 1; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment