javascript - touchend事件能实现复制后弹出提示框吗
PHPz
PHPz 2017-04-11 12:49:37
0
1
690

请问各位大神。

我想在网页里实现,复制微信号后提示:是否打开微信?

用失去焦点事件,貌似不太灵活。看到网上有人说:touchend事件可以实现?

请问各位大神,touchend事件具体应该怎么写?

求大神指点一下。。

PHPz
PHPz

学习是最好的投资!

reply all(1)
迷茫

。。。。。帮你百度好了!为什么就不自己去百度一下呢?
我觉得问问题应该是你写错的情况下问,而不是什么都没有的情况下问!

function load (){  
   
    document.addEventListener('touchstart',touch, false);  
    document.addEventListener('touchmove',touch, false);  
    document.addEventListener('touchend',touch, false);  
       
    function touch (event){  
        var event = event || window.event;  
           
        var oInp = document.getElementById("inp");  
   
        switch(event.type){  
            case "touchstart":  
                oInp.innerHTML = "Touch started (" + event.touches[0].clientX + "," + event.touches[0].clientY + ")";  
                break;  
            case "touchend":  
                oInp.innerHTML = "<br>Touch end (" + event.changedTouches[0].clientX + "," + event.changedTouches[0].clientY + ")";  
                break;  
            case "touchmove":  
                event.preventDefault();  
                oInp.innerHTML = "<br>Touch moved (" + event.touches[0].clientX + "," + event.touches[0].clientY + ")";  
                break;  
        }  
           
    }  
}  
window.addEventListener('load',load, false);  
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template