Skip to content

Instantly share code, notes, and snippets.

@stanwmusic
Created July 10, 2025 06:24
Show Gist options
  • Save stanwmusic/f18e6e23c35faf42ea311949641aa6b0 to your computer and use it in GitHub Desktop.
Save stanwmusic/f18e6e23c35faf42ea311949641aa6b0 to your computer and use it in GitHub Desktop.
Sticky Photostack
- var photos = ['https://images.unsplash.com/photo-1506744038136-46273834b3fb?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=600&h=600&q=50', 'https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=crop&w=600&h=600&q=50', 'https://images.unsplash.com/photo-1497671954146-59a89ff626ff?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=600&h=600&q=50', 'https://images.unsplash.com/photo-1502082553048-f009c37129b9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=600&h=600&q=50', 'https://images.unsplash.com/photo-1554629947-334ff61d85dc?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=600$h=600&q=50', 'https://images.unsplash.com/photo-1573480813647-552e9b7b5394?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=600$h=600&q=50', 'https://images.unsplash.com/photo-1509316785289-025f5b846b35?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=crop&w=600$h=600&q=50', 'https://images.unsplash.com/photo-1544568104-5b7eb8189dd4?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=600&h=600&q=50', 'https://images.unsplash.com/photo-1555424221-250de2a343ad?ixlib=rb-1.2.1&ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&auto=format&fit=crop&w=600&h=600&q=50'];
each photo in photos
figure
img(src=photo, width=1000, height=1000)
body {
background: #020520;
perspective: 500px;
overflow-x: hidden;
}
figure {
position: sticky;
top: 0;
display: flex;
align-items: center;
justify-content: center;
width: 100vw;
height: 100vh;
$photos: 10;
@for $i from 1 through $photos {
&:nth-child(#{$i}) {
img {
$rotation: (($i - 1)/ ($photos - 1)) - 0.5;
transform: scale(0.6) rotate($rotation * 25deg);
}
}
}
img {
width: 100vmin;
height: 100vmin;
border-radius: 3px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment