• 循环点击换图片


    $('.switch').click(function(){
    $('.switch').removeClass('speriod');
    $('.switch').addClass('divide'); //不被点击的变黑
    $(this).removeClass('divide');
    $(this).addClass('speriod'); //点击的变蓝

    var a = $(this).find('img').attr('src'); //点击的

    // console.log(b);
    if( a== 'images/icon/singlexin.png'){
    $(this).find('img').attr('src','images/icon/singlexin.png');
    $('.a').find('img').attr('src','images/icon/fen.png');
    }else if(a== 'images/icon/fen.png'){
    $(this).find('img').attr('src','images/icon/fenxin.png');
    $('.b').find('img').attr('src','images/icon/single.png');
    }else if( a== 'images/icon/single.png'){
    $(this).find('img').attr('src','images/icon/singlexin.png');
    $('.a').find('img').attr('src','images/icon/fen.png');
    }else if(a== 'images/icon/fenxin.png'){
    $(this).find('img').attr('src','images/icon/fenxin.png');
    $('.b').find('img').attr('src','images/icon/single.png');
    }

    });

    <div class=" clf speriod switch b" style="margin-right:11px;"><i>¥</i>20000.00<img src="images/icon/singlexin.png"></div>
    <div class="clf divide switch a"><i>¥</i>20000.00<img src="images/icon/fen.png"></div>

  • 相关阅读:
    购物网站被p.egou.com强制恶意劫持
    css下拉菜单
    StringToInt
    JframeMaxSize
    frameMaxSize
    inputChar
    英语要求
    sciAndSubject
    fileRename
    tensorflowOnWindows
  • 原文地址:https://www.cnblogs.com/isuansuan/p/10769437.html
Copyright © 2020-2023  润新知