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

点击同类选项出现文字

时间:2014-05-07 11:12:57      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   java   ext   

今天写一个订单页面时,要求:在多个地址中选择一个时,被选择的地址前面要有文字出现。

完成这个问题后,自己写一个简单的。

bubuko.com,布布扣
<html>
    <head>
        <title>wiming</title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <link href="../css/buy_now.css" rel="stylesheet" type="text/css">
        <script src="http://cdn.bootcss.com/jquery/2.1.0/jquery.min.js"></script> 
        <style type="text/css">
            p{ 
                text-align:center;
            }
            .fruit-list{
                margin:0 auto;
                margin-top:20px;
                text-align:center;
             }
             .fruit-list:hover{ 
                 background-color:#FF5511;
             }
             .mylove-list{
                 display:none;
             }
             .on .mylove-list{ 
                 display:inline;
             }
        </style>
        <script type="text/javascript">
             $(function(){ 
                     $(".fruit-list").click(function(){
                         $(".fruit-list").removeClass("on")
                         $(this).addClass("on")
                         })
                     })
        </script>
    </head>
    <body>
        <p>点你喜欢的水果?</p>
        <div class="fruit-list">
            <span class="mylove-list">我喜欢
            </span>
            <label>苹果
            </label>
        </div>
        <div class="fruit-list">
            <span class="mylove-list">我喜欢
            </span>
            <label>西瓜
            </label>
        </div>
        <div class="fruit-list">
            <span class="mylove-list">我喜欢
            </span>
            <label>芒果
            </label>
        </div>
        <div class="fruit-list">
            <span class="mylove-list">我喜欢
            </span>
            <label>雪梨
            </label>
        </div>
    </body>
</html>
bubuko.com,布布扣

 

点击同类选项出现文字,布布扣,bubuko.com

点击同类选项出现文字

标签:style   blog   class   code   java   ext   

原文地址:http://www.cnblogs.com/wiming/p/3712891.html

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