• 点击之后去取消当前的样式,给选中对象添加样式


    css

    .point_amount_label{
    120px;
    height: 40px;
    display: block;
    float: left;
    margin: 0 10px 0 0;
    text-align: center;
    border: 1px solid #e8e8e8;
    background-color: #f7f7f7;
    color: #999;
    cursor: pointer;
    line-height: 40px;
    }

    .click{
    border: 2px solid #1ba9d9;;
    color: #1ba9d9;
    120px;
    height: 40px;
    display: block;
    float: left;
    margin: 0 10px 0 0;
    text-align: center;
    line-height: 40px;
    }

    .arrow-down {
    2px;
    height:2px;
    border-left:10px solid transparent;
    border-right:10px solid transparent;
    border-top:10px solid #1ba9d9;
    transform: rotate(315deg);
    position: absolute;
    margin-top: -11px;
    margin-left: 104px;

    }

    html:

    <label id="credit_amount_20" class=" click have" amount="20">¥20.00<div class="arrow-down"></div></label>
    <label id="credit_amount_50" class="point_amount_label have" amount="50">¥50.00</label>
    <label id="credit_amount_100" class="point_amount_label have" amount="100">¥100.00</label>
    <label id="credit_amount_0" class="point_amount_label none" >其他金额</label>

    js:

    $("label").on({
    mouseover:function(){
    $(this).addClass('click');
    $(this).removeClass('point_amount_label');
    $(this).append('<div class="arrow-down"></div>');
    $(this).siblings('label').removeClass('click');
    $(this).siblings('label').addClass('point_amount_label');
    $(this).siblings('label').children().remove();
    },
    mouseout:function(){
    if(!isclick){
    $(this).addClass('point_amount_label');
    $(this).removeClass('click');
    $(this).children().remove();
    }
    },
    click:function(){
    $(".amount_input ").val('').focus();
    $('.red-text').text($(this).attr('amount'));
    $(this).siblings('label').removeClass('click');
    $(this).siblings('label').addClass('point_amount_label');
    $(this).siblings('label').children().remove();
    $(this).addClass('click');
    $(this).removeClass('point_amount_label');
    $(this).append('<div class="arrow-down"></div>');
    isclick=true;
    }
    });

    光标事件:

    $('.amount_input').blur(function(){
    var val=$('.amount_input').val();
    $('.red-text').text(val);

    });

  • 相关阅读:
    时期日期相关JS
    linq版本不同,升级后的问题
    Andriod小型管理系统(Activity,SQLite库操作,ListView操作)(源代码下载)
    FLASH所支持的HTML标记[转]
    从尘埃里开出花
    鴻海董事長郭台銘先生的話
    一日 :)
    今天休息,一个人在城市里看云 : (
    微软面试题——海盗分金币:)
    我QQ史上见过的最自恋,最芙蓉,最皮厚的人:口水弟: )
  • 原文地址:https://www.cnblogs.com/zouyun/p/7774199.html
Copyright © 2020-2023  润新知