左右滑动使 click事件失效

$('.col-wenzi').bind('click',function(e){

        leftorright=$(this).index();

        $(this).siblings().removeClass('active');

        $(this).addClass('active');

        $(".cm-content-all").hide().eq($('.col-wenzi').index(this)).show(); 

    });

  

$('.xl-top').bind('touchstart',function(i){

        starttopX = (i.originalEvent.targetTouches[0].pageX);

i.preventDefault();

    });

$(".xl-top").bind('touchend',function(e){

        var endX = (e.originalEvent.changedTouches[0].pageX);

        var offset=endX-starttopX;

        if (offset<=-30) {

e.preventDefault();

top_index++;

if(top_index<=max-4){

$('.col-wenzi').eq(top_index-top_off).css('display','none');

  $('.col-wenzi').eq(top_index+4).show();

}

else

top_index--;

}

        else if (offset>=30){

e.preventDefault();

if(top_index!=0){

$('.col-wenzi').eq(top_index-top_off).show();

  $('.col-wenzi').eq(top_index+4).css('display','none');

top_index--;

        }

        }

    })


qq_云里看雾_0
浏览 1464回答 1
1回答

一杯2块的奶茶

没有html代码吗
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5
JQuery