찾다

 >  Q&A  >  본문

javascript - touchend事件能实现复制后弹出提示框吗

请问各位大神。

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

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

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

求大神指点一下。。

PHPzPHPz2818일 전697

모든 응답(1)나는 대답할 것이다

  • 迷茫

    迷茫2017-04-11 12:51:37

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

    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);  

    회신하다
    0
  • 취소회신하다