现在效果讲究过渡与动态效果,比瞬间完成的效果要人性化很多。
下面是一段简单的代码实例,演示了淡入淡出效果。
代码实例如下:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.gaodaima.com/" /> <title>搞代码</title> <style type="text/css"> #thediv{ width:100px; height:100px; background-color:red; } </style> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ $("#outbt").click(function(){ $("#thediv").fadeOut(); }) $("#inbt").click(function(){ $("#thediv").fadeIn(); }) }) </script> </head> <body> <div id="thediv"></div> <input type="button" value="点击淡出" id="outbt"/> <input type="button" value="点击淡入" id="inbt"/> </body> </html>