码迷,mamicode.com
首页 > Web开发 > 详细

jquery练习

时间:2018-04-10 10:57:05      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:AC   pre   新手上路   png   mouse   round   seo   leave   white   

第四章

实现鼠标经过字体变白吗,背景变蓝的效果,鼠标离开,恢复原来的样式。

技术分享图片

<!DOCTYPE html>
<html>
  <head>
    <title>Unit.html</title>
    <style type="text/css">
    .a{
        background: blue;
        color: white;
    }
    </style>
    <script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
    <script type="text/javascript">
        $(function(){
            $("li").mouseover(function(){
                $(this).addClass("a");
            });
            $("li").mouseleave(function(){
                $(this).removeClass("a");
            });
            
        });
    </script>
  </head>
  
  <body>
    新手上路:
    <ul>
        <li>标题一</li>
        <li>标题一</li>
        <li>标题一</li>
        <li>标题一</li>
        <li>标题一</li>
    </ul>
  </body>
</html>

 

jquery练习

标签:AC   pre   新手上路   png   mouse   round   seo   leave   white   

原文地址:https://www.cnblogs.com/excellencesy/p/8776467.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!