| OLD | NEW |
| 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| 2 "http://www.w3.org/TR/html4/loose.dtd"> | 2 "http://www.w3.org/TR/html4/loose.dtd"> |
| 3 | 3 |
| 4 <html lang="en"> | 4 <html lang="en"> |
| 5 <head> | 5 <head> |
| 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 7 <title>Transition Events</title> | 7 <title>Transition Events</title> |
| 8 <style type="text/css" media="screen"> | 8 <style type="text/css" media="screen"> |
| 9 #box1 { | 9 #box1 { |
| 10 position: relative; | 10 position: relative; |
| 11 width: 100px; | 11 width: 100px; |
| 12 height: 100px; | 12 height: 100px; |
| 13 margin: 10px; | 13 margin: 10px; |
| 14 background-color: blue; | 14 background-color: blue; |
| 15 z-index: 0; | 15 z-index: 0; |
| 16 -webkit-transition-property: left; | 16 transition-property: left; |
| 17 -webkit-transition-duration: 2s; | 17 transition-duration: 2s; |
| 18 left: 0px; | 18 left: 0px; |
| 19 } | 19 } |
| 20 | 20 |
| 21 #box2 { | 21 #box2 { |
| 22 position: relative; | 22 position: relative; |
| 23 width: 100px; | 23 width: 100px; |
| 24 height: 100px; | 24 height: 100px; |
| 25 margin: 10px; | 25 margin: 10px; |
| 26 background-color: red; | 26 background-color: red; |
| 27 z-index: 0; | 27 z-index: 0; |
| 28 -webkit-transition-property: left; | 28 transition-property: left; |
| 29 -webkit-transition-duration: 2s; | 29 transition-duration: 2s; |
| 30 left: 0px; | 30 left: 0px; |
| 31 } | 31 } |
| 32 | 32 |
| 33 #log { | 33 #log { |
| 34 position: absolute; | 34 position: absolute; |
| 35 width: 90%; | 35 width: 90%; |
| 36 height: 200px; | 36 height: 200px; |
| 37 overflow: scroll; | 37 overflow: scroll; |
| 38 border: 1px solid black; | 38 border: 1px solid black; |
| 39 } | 39 } |
| 40 </style> | 40 </style> |
| 41 <script type="text/javascript" charset="utf-8"> | 41 <script type="text/javascript" charset="utf-8"> |
| 42 | 42 |
| 43 var switch1 = true; | 43 var switch1 = true; |
| 44 var switch2 = false; | 44 var switch2 = false; |
| 45 | 45 |
| 46 document.addEventListener('webkitTransitionEnd', function(e) { | 46 document.addEventListener('transitionend', function(e) { |
| 47 var id = "1"; | 47 var id = "1"; |
| 48 if (switch1) { | 48 if (switch1) { |
| 49 id = "2"; | 49 id = "2"; |
| 50 } | 50 } |
| 51 var offset = 200; | 51 var offset = 200; |
| 52 if (switch2) { | 52 if (switch2) { |
| 53 offset = 0; | 53 offset = 0; |
| 54 } | 54 } |
| 55 var box = document.getElementById("box" + id); | 55 var box = document.getElementById("box" + id); |
| 56 box.style.left = "" + offset + "px"; | 56 box.style.left = "" + offset + "px"; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 81 </div> | 81 </div> |
| 82 <div id="box2"> | 82 <div id="box2"> |
| 83 </div> | 83 </div> |
| 84 </div> | 84 </div> |
| 85 | 85 |
| 86 <div id="log"> | 86 <div id="log"> |
| 87 | 87 |
| 88 </div> | 88 </div> |
| 89 </body> | 89 </body> |
| 90 </html> | 90 </html> |
| OLD | NEW |