Css3 animation for switching viewport
Created
April 16, 2014 09:46
-
-
Save mamboer/10843361 to your computer and use it in GitHub Desktop.
A Pen by Levin Van.
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
%h1.c3toy-tit 点击 '下一篇' 体验! | |
#phone.c3toy | |
#screen.c3toy-screen | |
.c3toy-viewport.c3toy-first | |
.c3toy-header | |
文章标题A.. | |
%span#next1 下一篇 | |
.c3toy-content | |
.c3toy-box.c3toy-image | |
%i.icon-picture | |
.c3toy-box.c3toy-text ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ | |
.c3toy-box.c3toy-comment | |
.c3toy-avatar | |
%i.icon-user | |
.c3toy-bubble | |
.c3toy-box.c3toy-comment.c3toy-second | |
.c3toy-avatar | |
%i.icon-user | |
.c3toy-bubble | |
.c3toy-viewport.c3toy-last | |
.c3toy-header | |
文章标题2.. | |
%span#next2 上一篇 | |
.c3toy-content | |
.c3toy-box.c3toy-image | |
%i.icon-truck | |
.c3toy-box.c3toy-text ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ | |
.c3toy-box.c3toy-comment | |
.c3toy-avatar | |
%i.icon-user | |
.c3toy-bubble |
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
$("#next1").click(function(){ | |
$("#screen").addClass("c3toy-animate"); | |
}); | |
$("#next2").click(function(){ | |
$("#screen").removeClass("c3toy-animate"); | |
}); |
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
@import url(http://fonts.googleapis.com/css?family=Montserrat:400,700); | |
@import "//netdna.bootstrapcdn.com/font-awesome/3.0/css/font-awesome.css"; | |
html { | |
background: #1fc092; | |
} | |
.c3toy-tit { | |
color:white; | |
width:240px; | |
font-size:24px; | |
font-family:Montserrat; | |
text-align:center; | |
margin:100px auto 30px; | |
} | |
.c3toy { | |
background: #2c3e50; | |
border-radius: 30px; | |
left: 0; | |
margin: 0 auto 0; | |
padding: 70px 18px 68px 18px; | |
position: absolute; | |
right: 0; | |
width: 240px; | |
} | |
.c3toy:before { | |
background: #1f2b38; | |
border-radius: 20px; | |
content: ''; | |
height: 8px; | |
left: 0; | |
margin: -35px auto; | |
position: absolute; | |
right: 0; | |
width: 45px; | |
} | |
.c3toy:after { | |
background: #1f2b38; | |
border-radius: 20px; | |
content: ""; | |
display: block; | |
height: 42px; | |
left: 0; | |
margin: 12px auto; | |
position: absolute; | |
right: 0; | |
width: 42px; | |
} | |
.c3toy-screen { | |
background: #d6e6e9; | |
-webkit-perspective: 800px; | |
-moz-perspective: 800px; | |
-o-perspective: 800px; | |
perspective: 800px; | |
height: 400px; | |
overflow: hidden; | |
padding: 0; | |
position: relative; | |
width: 240px; | |
} | |
.c3toy-viewport { | |
-webkit-transition: all .4s; | |
-moz-transition: all .4s; | |
-o-transition: all .4s; | |
transition: all .4s; | |
background: #d6e6e9; | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
} | |
.c3toy-first { | |
z-index: 2; | |
left: 0; | |
-webkit-transform-origin: 0% 0%; | |
-webkit-transform: rotateY(0deg); | |
-moz-transform-origin: 0% 0%; | |
-moz-transform: rotateY(0deg); | |
} | |
.c3toy-last { | |
z-index: 1; | |
top: 400px; | |
} | |
.c3toy-animate .c3toy-last { | |
top: 0; | |
} | |
.c3toy-animate .c3toy-first { | |
-webkit-transform: rotateY(110deg); | |
-moz-transform: rotateY(110deg); | |
} | |
.c3toy-last .c3toy-image { | |
left: 240px; | |
-webkit-transition-delay: 0.2s; | |
-o-transition-delay: 0.2s; | |
transition-delay: 0.2s; | |
} | |
.c3toy-last .c3toy-text { | |
left: -240px; | |
-webkit-transition-delay: 0.3s; | |
-o-transition-delay: 0.3s; | |
transition-delay: 0.3s; | |
} | |
.c3toy-last .c3toy-comment { | |
bottom: -150px; | |
-webkit-transition-delay: 0.4s; | |
-o-transition-delay: 0.4s; | |
transition-delay: 0.4s; | |
} | |
.c3toy-animate .c3toy-last .c3toy-image { | |
left: 0; | |
} | |
.c3toy-animate .c3toy-last .c3toy-text { | |
left: 0; | |
} | |
.c3toy-animate .c3toy-last .c3toy-comment { | |
bottom: 0; | |
} | |
.c3toy-header { | |
color: #ddebee; | |
background: #55b5c9; | |
font-family: Montserrat; | |
font-weight: bold; | |
width: 100%; | |
box-sizing: border-box; | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
padding: 15px; | |
text-transform: uppercase; | |
font-size: 14px; | |
} | |
.c3toy-header span { | |
float: right; | |
background: #ddebee; | |
color: #55b5c9; | |
font-size: 11px; | |
padding: 5px; | |
margin-top: -3px; | |
cursor: pointer; | |
} | |
.c3toy-content { | |
width: 100%; | |
height: 150px; | |
box-sizing: border-box; | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
padding: 15px; | |
} | |
.c3toy-box { | |
margin: 0 0 15px; | |
width: 100%; | |
position:relative; | |
background: #fcffff; | |
box-sizing: border-box; | |
-webkit-box-sizing: border-box; | |
-moz-box-sizing: border-box; | |
-webkit-transition: all .3s; | |
-moz-transition: all .3s; | |
-o-transition: all .3s; | |
transition: all .3s; | |
padding: 15px; | |
} | |
.c3toy-image { | |
font-size: 72px; | |
color: #a9c8d8; | |
text-align: center; | |
line-height: 1; | |
} | |
.c3toy-text { | |
color: #bbe3c1; | |
word-break:break-all; | |
padding: 15px 15px 5px 15px; | |
} | |
.c3toy-comment { | |
overflow: hidden; | |
padding: 0; | |
background: #d6e6e9; | |
} | |
.c3toy-avatar { | |
float: left; | |
overflow: hidden; | |
width: 45px; | |
height: 45px; | |
background: white; | |
border-radius: 50%; | |
color: #94d9ec; | |
font-size: 32px; | |
text-align: center; | |
line-height: 70px; | |
} | |
.c3toy-bubble { | |
position: relative; | |
float: right; | |
width: 150px; | |
height: 45px; | |
background: white; | |
} | |
.c3toy-bubble:after { | |
content: ""; | |
position: absolute; | |
border-style: solid; | |
display: block; | |
width: 0; | |
top: 14px; | |
margin-left: -8px; | |
bottom: auto; | |
border-width: 8px 8px 8px 0px; | |
border-color: transparent white; | |
} | |
.c3toy-second .c3toy-avatar { | |
float: right; | |
} | |
.c3toy-second .c3toy-bubble { | |
float: left; | |
} | |
.c3toy-second .c3toy-bubble:after { | |
right: -8px; | |
margin-left: 0; | |
border-width: 8px 0px 8px 8px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment