Created
October 18, 2012 05:00
-
-
Save mattmccray/3909935 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| body | |
| div.stack | |
| div.view | |
| p View One | |
| button.next Next | |
| div.view | |
| p View Two | |
| button.back Back | |
| | | |
| button.next Next | |
| div.view | |
| p View Three | |
| button.back Back | |
| | | |
| button.next Next | |
| div.view | |
| p View Four | |
| button.back Back | |
| | | |
| button.next Next | |
| div.view | |
| p View Five | |
| button.back Back |
This file contains hidden or 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
| var curr= null, | |
| outPos= "30px", | |
| inPos= "6px"; | |
| $('.view').css({ | |
| opacity: 0, | |
| zIndex: 0, | |
| left: outPos | |
| }); | |
| curr= $('.view:first').css({ | |
| opacity: 1, | |
| zIndex: 999, | |
| left: inPos | |
| }); | |
| setTimeout(function(){ | |
| $('.view').addClass('transitionable'); | |
| },1); | |
| $('.back').on('click', function(e) { | |
| e.preventDefault(); | |
| goBack(); | |
| }); | |
| $('.next').on('click', function(e) { | |
| e.preventDefault() | |
| goNext(); | |
| }); | |
| function goNext() { | |
| var cV= curr, | |
| nV= curr.next('.view'); | |
| cV.css({ | |
| zIndex: 0 | |
| }) | |
| nV.css({ | |
| zIndex: 999, | |
| opacity: 1, | |
| left: inPos | |
| }) | |
| curr= nV; | |
| } | |
| function goBack() { | |
| var cV= curr, | |
| nV= curr.prev('.view'); | |
| cV.css({ | |
| opacity: 0, | |
| left: outPos | |
| }) | |
| setTimeout(function(){ | |
| cV.css({ | |
| zIndex: 0 | |
| }) | |
| nV.css({ | |
| zIndex: 999 | |
| }) | |
| }, 500); | |
| curr= nV; | |
| } |
This file contains hidden or 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
| body { | |
| background: #474747; | |
| padding: 20px 300px; | |
| box-sizing: border-box; | |
| font-family: "Helvetica Neue"; | |
| font-weight: 300; | |
| } | |
| .stack { | |
| position: relative; | |
| width: 300px; | |
| height: 250px; | |
| margin: 0 auto; | |
| box-shadow: 0px 4px 10px #000; | |
| border-radius: 3px; | |
| background: #E5E5E5; | |
| padding: 5px; | |
| border: 3px solid #fff; | |
| overflow: hidden; | |
| } | |
| .view { | |
| position: absolute; | |
| background: #fff; | |
| border: 1px solid silver; | |
| width: 295px; | |
| height: 245px; | |
| text-align: center; | |
| opacity: 0; | |
| } | |
| .transitionable { | |
| transition: all ease-out 0.4s; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment