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>Get Computed Transform</title> | 7 <title>Get Computed Transform</title> |
8 <style type="text/css" media="screen"> | 8 <style type="text/css" media="screen"> |
9 .box { | 9 .box { |
10 height: 200px; | 10 height: 200px; |
11 width: 200px; | 11 width: 200px; |
12 background-color: #00a0a0; | 12 background-color: #00a0a0; |
13 } | 13 } |
14 </style> | 14 </style> |
15 <script type="text/javascript" charset="utf-8"> | 15 <script type="text/javascript" charset="utf-8"> |
16 function printTransform(event) | 16 function printTransform(event) |
17 { | 17 { |
18 var box = event.target; | 18 var box = event.target; |
19 var computedTransform = window.getComputedStyle(box).webkitTransform
; | 19 var computedTransform = window.getComputedStyle(box).webkitTransform
; |
20 document.getElementById("output").innerHTML = 'Computed transform is
' + computedTransform; | 20 document.getElementById("output").innerHTML = 'Computed transform is
' + computedTransform; |
21 } | 21 } |
22 | 22 |
23 </script> | 23 </script> |
24 </head> | 24 </head> |
25 <body onclick="printTransform(event)"> | 25 <body onclick="printTransform(event)"> |
26 | 26 |
27 <h1>Testing transform computed style</h1> | 27 <h1>Testing transform computed style</h1> |
28 <p>All boxes are 200x200 pixels. When you click on an element, the computed tran
sform style will be displayed below</p> | 28 <p>All boxes are 200x200 pixels. When you click on an element, the computed tran
sform style will be displayed below</p> |
29 <p id="output">Computed style for -webkit-transform displayed here</p> | 29 <p id="output">Computed style for transform displayed here</p> |
30 | 30 |
31 | 31 |
32 <div class="box" style="position: absolute; left: 100px; top: 200px; -webkit-tra
nsform: scale(1.5, 0.75)"> | 32 <div class="box" style="position: absolute; left: 100px; top: 200px; transform:
scale(1.5, 0.75)"> |
33 scale(1.5, 0.75) | 33 scale(1.5, 0.75) |
34 </div> | 34 </div> |
35 | 35 |
36 <div class="box" style="position: absolute; left: 400px; top: 200px; -webkit-tra
nsform: rotate(30deg)"> | 36 <div class="box" style="position: absolute; left: 400px; top: 200px; transform:
rotate(30deg)"> |
37 rotate(30deg) | 37 rotate(30deg) |
38 </div> | 38 </div> |
39 | 39 |
40 <div class="box" style="position: absolute; left: 100px; top: 400px; -webkit-tra
nsform: translate(50px, 80px)"> | 40 <div class="box" style="position: absolute; left: 100px; top: 400px; transform:
translate(50px, 80px)"> |
41 translate(50px, 80px) | 41 translate(50px, 80px) |
42 </div> | 42 </div> |
43 | 43 |
44 <div class="box" style="position: absolute; left: 400px; top: 400px; -webkit-tra
nsform: translate(10px, 50px) scale(0.8) rotate(-10deg)"> | 44 <div class="box" style="position: absolute; left: 400px; top: 400px; transform:
translate(10px, 50px) scale(0.8) rotate(-10deg)"> |
45 translate(10px, 50px) scale(0.8) rotate(-10deg) | 45 translate(10px, 50px) scale(0.8) rotate(-10deg) |
46 </div> | 46 </div> |
47 | 47 |
48 </body> | 48 </body> |
49 </html> | 49 </html> |
OLD | NEW |