码迷,mamicode.com
首页 > 其他好文 > 详细

工具栏图标切换

时间:2016-01-23 18:20:26      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        div{
            background-repeat:no-repeat;
            background-size: 100% 100%;
            float:left;
            width:2rem;
            height:2rem;
            margin-right:1rem;
        }
        .one{
            background-image:url("../images/statistic.png");
        }
        .one.active{
            background-image:url("../images/statistic-c.png")
        }
        .two{
            background-image:url("../images/recommend.png")
        }
        .two.active{
            background-image:url("../images/recommend-c.png")
        }
        .three{
            background-image:url("../images/reward.png")
        }
        .three.active{
            background-image:url("../images/reward-c.png")
        }

    </style>
</head>
<body>
<div  class="one active"></div>
<div  class="two"></div>
<div class="three"></div>
</body>
<script type="text/javascript" src="../js/jquery-1.7.2.js"></script>
<script>
    $("div").click(function(){
        $(this).addClass("active");
        $(this).siblings().removeClass("active")
    })
</script>
</html>

  

工具栏图标切换

标签:

原文地址:http://www.cnblogs.com/youaremysunshine/p/5153699.html

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