开始移动说话_按住说话怎么不能用了

开始移动说话_按住说话怎么不能用了2019独角兽企业重金招聘Python工程师标准>>>…

大家好,又见面了,我是你们的朋友全栈君。

(function(){
    var LSwiperMaker = function(o){ 
        var that = this;
        this.config = o;
        this.control = false;
        this.sPos = {};
        this.mPos = {};
        this.dire;     
        this.config.bind.addEventListener('touchstart', function(e){ return that.start(e); } ,false);
        //this.config.bind.addEventListener('touchmove', function(e){ return that.move(e); } ,false);
        this.config.bind.addEventListener('touchend', function(e){ return that.end(e); } ,false);
    } 
     LSwiperMaker.prototype.start = function(e){
		$(".sound_gif").show();
                e.preventDefault();   //!!!阻止微信默认长按弹出的菜单
    }
    /*LSwiperMaker.prototype.move = function(e){   
        var point = e.touches ? e.touches[0] : e;
        this.control = true;
        this.mPos.x = point.screenX;
        this.mPos.y = point.screenY;
       	$("#play").css("left",this.mPos.x+"px");   
       	
    } */
    LSwiperMaker.prototype.end = function(e){
		$(".sound_gif").hide();
    } 
    window.LSwiperMaker = LSwiperMaker;
    document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);// 禁止微信touchmove冲突
}())
//创建新的LSwiperMaker对象,并传入要拖动的图标
var a = new LSwiperMaker({
	bind:document.getElementById("sound_reserve")
})

只需要touchstart和touchend事件配合

需要注意的是,构造函数LSwiperMaker里的this,指的是新创建的对象实例,在例子中指的是new创建的a对象。

传{bind:document.getElementById(“sound_reserve”)}入构造函数的参数o,

this.config = o;

也就是把传参o赋值给新建对象(例子是a)的config属性

this.config.bind.addEventListener('touchstart', function(e){ return that.start(e); } ,false);

这里的bind是传参o的一个属性,这里的意思是为bind的属性值绑定事件,也就是ID为sound_reserve的元素。

转载于:https://my.oschina.net/daladida/blog/736609

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/125143.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号