transition-duration-002-manual.html (1293B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Transitions Test: transition-duration - positive 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.2. The 'transition-duration' Property" href="http://www.w3.org/TR/css3-transitions/#transition-duration-property"> 7 <meta name="assert" content="The 'transition-duration' property set positive number specifies the time that transition from the old value to the new value should take."> 8 <style> 9 div { 10 background-color: yellow; 11 height: 100px; 12 transition-duration: 2s; 13 transition-property: width; 14 transition-timing-function: linear; 15 width: 100px; 16 } 17 </style> 18 <body> 19 <p>Click the yellow square below. Test passes if the width of square stops growing when the number inside square is '2'.</p> 20 <div>0</div> 21 <script> 22 (function() { 23 var div = document.querySelector("div"); 24 div.addEventListener("click", function(evt) { 25 div.setAttribute("style", "width: 200px;"); 26 setInterval(function() { 27 var timer = parseInt(div.textContent, 10); 28 timer++; 29 div.textContent = timer; 30 }, 1000); 31 }, false); 32 })(); 33 </script> 34 </body>