Advertisement
Guest User

Untitled

a guest
Nov 5th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var STATE = 0
  2. var image1 = document.getElementById('image1')
  3. var image2 = document.getElementById('image2')
  4. var image3 = document.getElementById('image3')
  5.  
  6. document.getElementById('next').onclick = function next() {
  7.     switch (STATE) {
  8.         case 0: toState1(); break
  9.         case 1: toState2(); break
  10.         case 2: toState0(); break
  11.     }
  12. }
  13.  
  14. document.getElementById('preview').onclick = function preview() {
  15.     switch (STATE) {
  16.         case 0: toState2(); break
  17.         case 1: toState0(); break
  18.         case 2: toState1(); break
  19.     }
  20. }
  21.  
  22. function toState0() {
  23.     STATE = 0
  24.  
  25.     image1.style.webkitTransform = image3.style.webkitTransform = 'scale(1)'
  26.     image2.style.webkitTransform = 'scale(1.2)'
  27.  
  28.     image1.style.zIndex = image3.style.zIndex = 0
  29.     image2.style.zIndex = 1
  30.  
  31.     image1.style.right = "-150px"
  32.     image2.style.right = "0px"
  33.     image3.style.right = "150px"
  34. }
  35.  
  36. function toState1() {
  37.     STATE = 1
  38.  
  39.     image1.style.webkitTransform = 'scale(1.2)'
  40.     image2.style.webkitTransform = image3.style.webkitTransform = 'scale(1)'
  41.  
  42.     image1.style.zIndex = 1
  43.     image2.style.zIndex = image3.style.zIndex = 0
  44.  
  45.     image1.style.right = '-450px'
  46.     image2.style.right = '-300px'
  47.     image3.style.right = '750px'
  48. }
  49.  
  50. function toState2() {
  51.     STATE = 2
  52.  
  53.     image1.style.webkitTransform = image2.style.webkitTransform = 'scale(1)'
  54.     image3.style.webkitTransform = 'scale(1.2)';
  55.  
  56.     image1.style.zIndex = image2.style.zIndex = 0
  57.     image3.style.zIndex = 1
  58.  
  59.     image1.style.right = '-750px'
  60.     image2.style.right = '300px'
  61.     image3.style.right = '450px'
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement