Last active
October 8, 2015 16:54
-
-
Save tdhartwick/56f08ae077cd879d893d to your computer and use it in GitHub Desktop.
The meat of css-flip-book!
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
.flip-book { | |
position: absolute; | |
bottom: 0; | |
right: 0; | |
width: $dimension; | |
height: $dimension; | |
} | |
//Preload images hack with CSS. | |
$string:''; | |
@for $i from 1 through $number-of-slides { | |
$string: $string + " url('../img/#{$directory-name}/#{$animation-name}-#{$i}.png')"; | |
} | |
//Uses the preloader hack only on webkit screens. Firefox had some issues interpreting the preloading hack. | |
@media screen and (-webkit-min-device-pixel-ratio: 0) { | |
body:after{ | |
display:none; | |
content: unquote($string); | |
} | |
} | |
//Iterates through and adds the background images | |
@for $e from 1 through $number-of-repeats { | |
//iterates through and adds the background images | |
@for $i from 1 through $number-of-slides { | |
@media screen and (min-width: $starting-width) { | |
.flip-book { | |
background: url('../img/#{$directory-name}/#{$animation-name}-#{$i}.png') bottom center / 100% no-repeat; | |
} | |
$starting-width: $starting-width + $fps; | |
} | |
} | |
} | |
//Ends the flip book. | |
@media screen and (min-width: $starting-width) { | |
.flip-book { | |
background: none; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment