3 <title>Transition End Events
</title>
4 <style type=
"text/css" media=
"screen">
11 background-color: blue;
12 -webkit-transition-property: width, left, background-color, height, top;
13 -webkit-transition-duration:
0.5s;
21 background-color: red;
27 background-color: green;
30 -webkit-transition-duration:
0.6s;
36 -webkit-transition-duration:
0.3s;
44 <script src=
"transition-end-event-helpers.js" type=
"text/javascript" charset=
"utf-8"></script>
45 <script type=
"text/javascript" charset=
"utf-8">
47 var expectedEndEvents = [
48 // [property-name, element-id, elapsed-time, listen]
49 [
"background-color",
"box2",
0.5, false],
50 [
"background-color",
"box3",
0.6, false],
51 [
"height",
"box3",
0.6, false],
52 [
"height",
"box4",
0.3, false],
53 [
"left",
"box1",
0.5, false],
54 [
"left",
"box2",
0.5, false],
55 [
"left",
"box3",
0.6, false],
56 [
"left",
"box4",
0.3, false],
57 [
"width",
"box3",
0.6, false]
60 function transitionElement(index)
62 var boxes = document.body.getElementsByClassName('box');
63 boxes[index-
1].className =
"box box" + index;
68 var boxes = document.body.getElementsByClassName('box');
69 for (var i =
0; i < boxes.length; ++i) {
70 boxes[i].addEventListener(
"webkitTransitionEnd", recordTransitionEndEvent, false);
73 window.setTimeout(function() { transitionElement(
1); },
100);
74 window.setTimeout(function() { transitionElement(
2); },
150);
75 window.setTimeout(function() { transitionElement(
3); },
200);
76 window.setTimeout(function() { transitionElement(
4); },
50);
77 window.setTimeout(function() { transitionElement(
5); },
150);
80 runTransitionTest(expectedEndEvents,
2.0, setupTest);
86 <p>Initiating transitions on various properties of all boxes, with different start times on the transitions.
</p>
89 <div id=
"box1" class=
"box"></div>
90 <div id=
"box2" class=
"box"></div>
91 <div id=
"box3" class=
"box"></div>
92 <div id=
"box4" class=
"box"></div>
93 <div id=
"box5" class=
"box"></div>
96 <div id=
"result"></div>