CSS transition的用法代码:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>前端ABC-CSS transition的用法</title> <script type="text/javascript" src="js/jquery-1.12.4.js"></script> <style> div{ height: 10px; width: 10px; margin: 100px auto; background-color: #007997; transition:height 2s linear; } div.active{ margin: 200px auto; width: 200px; height: 50px; } </style> <script> $(function(){ console.log($("div").height()); setTimeout(function () { $("div").addClass("active"); setTimeout(function () { $("div").height(10); },2000); // $("input").clear("hello"); clearValue( $("input"),"2016"); },1000); }); $.fn.clear = function(val){ $(this).val(val); }; function clearValue($target,val){ $target.val("123"); } </script> </head> <body> <input type="text" value="12345"> <div></div> </body> </html>
欢迎分享本文,转载请保留出处:前端ABC » CSS中transition的用法