A Pen by Jake Albaugh on CodePen.
Created
October 5, 2015 05:29
-
-
Save anonymous/dd75fbe3dcddcd497e47 to your computer and use it in GitHub Desktop.
Infinite sliding image
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
<div class="slider"> | |
<div class="slider-row"></div> | |
</div> |
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
$img-w: 5912px; | |
$img-h: 389px; | |
$shrink: 2; | |
$ratio: 1 / $shrink; | |
$speed: 50s; | |
.slider { | |
position: absolute; | |
width: 100%; | |
top: calc(50% - #{$img-h * $ratio / 2}); | |
overflow: hidden; | |
.slider-row { | |
width: $img-w * $ratio; | |
height: $img-h * $ratio; | |
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/111863/ubiquity-summit-web-01.png); | |
background-size: $img-w * $ratio $img-h * $ratio; | |
animation: slide $speed linear infinite; | |
} | |
} | |
@keyframes slide { | |
from { background-position-x: 0; } | |
to { background-position-x: -$img-w * $ratio; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment