Skip to content

Instantly share code, notes, and snippets.

@co2bo
Last active February 6, 2017 11:33
Show Gist options
  • Select an option

  • Save co2bo/c3098e97f63619da01fc617bfbf188c5 to your computer and use it in GitHub Desktop.

Select an option

Save co2bo/c3098e97f63619da01fc617bfbf188c5 to your computer and use it in GitHub Desktop.
<!-- Slider -->
<div class='wrapper'>
<div class='header'>
<div class='bg bg-1'></div>
<div class='bg bg-2'></div>
<div class='bg bg-3'></div>
</div>
</div>
// ==========================================================================
// _slider.scss
// ==========================================================================
// Delay
// ----------------------------------------
@mixin delay($str) {
+css3-prefix(animation-delay, $str);
}
// Animation
// ----------------------------------------
@mixin animation($str) {
+css3-prefix(animation, $str);
}
// Keyframes
// ----------------------------------------
@mixin keyframes($animation-name) {
@-webkit-keyframes #{$animation-name} {
@content;
}
@-moz-keyframes #{$animation-name} {
@content;
}
@-ms-keyframes #{$animation-name} {
@content;
}
@-o-keyframes #{$animation-name} {
@content;
}
@keyframes #{$animation-name} {
@content;
}
}
.header {
@include position(relative);
height: 350px;
}
%bg {
@include position(relative);
@include position(absolute);
top: 0;
left: 0;
width: 100%;
height: 100%;
@include animation(fade 15s ease infinite);
}
.bg-1 {
@extend %bg;
background: image-url('slider/slide_1.jpg') no-repeat center;
@include background-size(cover);
@include delay(10s);
}
.bg-2 {
@extend %bg;
background: image-url('slider/slide_2.jpg') no-repeat center;
@include background-size(cover);
@include delay(5s);
}
.bg-3 {
@extend %bg;
background: image-url('hslider/slide_3.jpg') no-repeat center;
@include background-size(cover);
@include delay(0s);
}
.wrapper {}
@include keyframes(fade) {
0% {
@include opacity(1);
}
12.5% {
@include opacity(1);
}
25% {
@include opacity(1);
}
37.5% {
@include opacity(0);
}
50% {
@include opacity(0);
}
62.5% {
@include opacity(0);
}
75% {
@include opacity(0);
}
87.5% {
@include opacity(0);
}
100% {
@include opacity(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment