2. 设置菜单的CSS样式
- body
- {
- font-family:@微软雅黑;
- background:#f3f3f3;
- }
- ul
- {
- margin:0;
- padding:0;
- }
- li
- {
- width:100px;
- height:50px;
- float:left;
- color:#191919;
- text-align:center;
- overflow:hidden;
- }
- a
- {
- color:#fff;
- text-decoration:none;
- }
- p
- {
- padding:0px 5px;
- }
- .subtext
- {
- padding-top:15px;
- }
- .green{background:#6aa63b url('images/green-item-bg.jpg')top left no-repeat;}
- .yellow{background:#FBC700 url('images/yellow-item-bg.jpg')top left no-repeat;}
- .red{background:#D52100 url('images/red-item-bg.jpg')top left no-repeat;}
- .purple{background:#5122B4 url('images/purple-item-bg.jpg')top left no-repeat;}
- .blue{background:#0292C0 url('images/blue-item-bg.jpg')top left no-repeat;}
3. 导入jquery-1.4.1.js和jquery动画效果扩展插件jquery.easing.js 1.3,并编写Jquery代码
- <link href="StyleSheet1.css" rel="stylesheet" type="text/css" />
- <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
- <%--导入jquery动画效果扩展插件jquery.easing.js 1.3--%>
- <script src="jquery.easing.1.3.js" type="text/javascript"></script>
- <script type="text/javascript" >
- $(document).ready(function(){
- //注册超链接的单击事件
- $("a").click(function(){
- $(this).blur(); //失去焦点触发的事件
- });
- //鼠标移到li上边的事件
- $("li").mouseover(function(){
- //停在指定的元素上(stop)自定义动画(animate)
- $(this).stop().animate({height: '200px' }, { queue: false, duration: 600, easing: 'easeOutBounce' })
- });
- //鼠标移出li的事件
- $("li").mouseout(function(){
- $(this).stop().animate({height:'50px'},{queue:false,duration:600,easing:'easeOutBounce'});
- });
- });
- </script>
到此我们已经把效果做出来了,效果如下图所示:

