日期:2014-05-16 浏览次数:20393 次
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script> <style> .mainContent{ position: absolute; top:10px; left: 50px; right: 50px; height: 50px; } ul{ float: left; margin: 0; padding: 0; } li{ float: left; padding: 5px; list-style: none; cursor: pointer; border: 1px solid red; margin-left: 2px; } </style> <script> $(function(){ $('.mainContent ul li').mouseover(function(){ $(this).animate({ //起不到作用 backgroundColor:'blue', //用透明度的话,字体跟着变淡了,字体是要求不变的 opacity:0.2 },500); }) $('.mainContent ul li').mouseout(function(){ $(this).animate({ backgroundColor:'#000', opacity:1 },500); }) }) </script> </head> <body> <div class="mainContent"> <ul> <li id="mao">首页</li> <li>系统配置</li> <li>系统管理</li> <li>退出</li> </ul> </div> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script language="JavaScript" src="/js/jquery-1.8.2.min.js" type="text/javascript"></script> <script language="JavaScript" src="/js/jquery.color.js" type="text/javascript"></script> <style type="text/css"> .mainContent{ position: absolute; top:10px; left: 50px; right: 50px; height: 50px;