Created
August 19, 2012 00:56
-
-
Save matthewcopeland/3390653 to your computer and use it in GitHub Desktop.
Display vs Visibility: Avoid bg-image load delays for mobile users.
This file contains 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 loads on hover. | |
* users (think mobile) may experience a delay loading the image. | |
*/ | |
.class { | |
background-image: url('some-image'); | |
display: none; | |
} | |
.class:hover { display: block; } |
This file contains 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 loads on page-load. | |
* no delay on :hover. | |
*/ | |
.class { | |
background-image: url('some-image'); | |
visibility: hidden; | |
} | |
.class:hover { visibility: visible; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment