Skip to content

Instantly share code, notes, and snippets.

@tdhartwick
Last active October 8, 2015 16:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdhartwick/56f08ae077cd879d893d to your computer and use it in GitHub Desktop.
Save tdhartwick/56f08ae077cd879d893d to your computer and use it in GitHub Desktop.
The meat of css-flip-book!
.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