transition-delay-003-manual.html (1553B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Transition Test: transition-delay - negative number</title> 4 <link rel="author" title="Intel" href="http://www.intel.com"> 5 <link rel="author" title="Shiyou Tan" href="mailto:shiyoux.tan@intel.com"> 6 <link rel="help" title="2.4. The 'transition-delay' Property" href="http://www.w3.org/TR/css3-transitions/#transition-delay-property"> 7 <meta name="assert" content="Test checks that the 'transition-delay' property set negative number will not delay the execution of transition"> 8 <style> 9 div { 10 height: 100px; 11 transition-property: background-color; 12 width: 100px; 13 } 14 #ref { 15 background-color: gray; 16 transition-delay: 3s; 17 } 18 #test { 19 background-color: blue; 20 transition-delay: -3s; 21 } 22 </style> 23 <body> 24 <p>Click the blue square below. Test passes if the <strong>color</strong> of blue and gray squares is all changed to <strong>green</strong> immediately 25 when the number inside blue square is 3.</p> 26 <div id="ref"></div> 27 <div id="test">0</div> 28 <script> 29 var clicked = 0; 30 var ref = document.getElementById("ref"); 31 var test = document.getElementById("test"); 32 test.addEventListener("click", function(evt) { 33 if (clicked == 0) { 34 ref.setAttribute("style", "background-color: green;"); 35 setInterval(function() { 36 if (clicked == 2) { 37 test.setAttribute("style", "background-color: green;"); 38 } 39 clicked++; 40 test.innerHTML = clicked; 41 }, 1000); 42 } 43 }, false); 44 </script> 45 </body>