Skip to content

Instantly share code, notes, and snippets.

@scottkellum
Created December 6, 2012 02:39
Show Gist options
  • Select an option

  • Save scottkellum/4221402 to your computer and use it in GitHub Desktop.

Select an option

Save scottkellum/4221402 to your computer and use it in GitHub Desktop.
// HTML
<body id="dark">
<div class="rotate">
<a href="#light" class="light"></a>
<a href="#dark" class="dark"></a>
</div>
</body>
// SCSS
@-webkit-keyframes rotate-one {
from {
@include transform(rotate(0deg));
}
to {
@include transform(rotate(180deg));
}
}
@-webkit-keyframes rotate-two {
from {
@include transform(rotate(180deg));
}
to {
@include transform(rotate(360deg));
}
}
body {
background-color: #fff;
@include transition(background-color .5s);
&:target {
background-color: #000;
}
}
.rotate {
width: 120px;
height: 120px;
border-radius: 50%;
position: relative;
-webkit-animation: rotate-one 1s;
body:target & {
-webkit-animation: rotate-two 1s;
}
}
.light, .dark {
width: 30px;
height: 30px;
border-radius: 50%;
display: block;
position: absolute;
left: 45px;
@include transition(all .5s);
}
.light {
background-color: #fff;
bottom: 10px;
}
.dark {
background-color: #000;
top: 10px;
}
ul {
display: none !Important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment