移动端a链接按下背景变色js

来源:互联网 发布:python里的三引号 编辑:程序博客网 时间:2024/06/16 21:56

注意移动端的按下,是touchstart,和touchend。。。

function clickBg(obj,color01,color02){

    obj.on('touchstart',function(){
        $(this).css({
            background:color01
        });
    });
    obj.on('touchend',function(){
        $(this).css({
            background:color02
        });
    });

}

clickBg($('.search-help a'),'#e3e5e9','#fff');

0 0
原创粉丝点击