• 移动端跳转方案-解决误触


    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no" />
            <title></title>
            <style type="text/css">
                *{
                    margin: 0;
                    padding: 0;
                }
                
            </style>
        </head>
        <body>
            <a href="http://www.qixianchuan.com">回娘家</a>
            <a href="http://www.qixianchuan.com">回娘家</a>
            <a href="http://www.qixianchuan.com">回娘家</a>
            <a href="http://www.qixianchuan.com">回娘家</a>
            <a href="http://www.qixianchuan.com">回娘家</a>
            <a href="http://www.qixianchuan.com">回娘家</a>
            <a href="http://www.qixianchuan.com">回娘家</a>
        </body>
        <script type="text/javascript">
            window.onload=function(){
                document.addEventListener("touchstart",function(ev){
                    ev=ev||event;
                    ev.preventDefault();
                })
                
                
                //移动端a标签的跳转方案  解决误触
                var aNodes = document.querySelectorAll("a");
                for(var i=0;i<aNodes.length;i++){
                    aNodes[i].addEventListener("touchstart",function(){
                        this.isMoved=false;
                    })
                    
                    
                    aNodes[i].addEventListener("touchmove",function(){
                        this.isMoved=true;
                    })
                    
                    
                    aNodes[i].addEventListener("touchend",function(){
                        if(!this.isMoved){
                            location.href=this.href;
                        }
                    })
                }
            }
            
            
        </script>
    </html>
    业精于勤荒于嬉,行成于思毁于随
  • 相关阅读:
    02基础软件安装
    01系统软件安装
    dmesg命令
    perl 远程连接oracle
    延时取消订单还在用定时任务?来看mq的实现
    微信公众号开发Java版-学习总结
    (转)SQL Server 2008 允许远程连接的解决方法
    java生成pdf并加水印,通过wkhtmltopdf实现
    boostrap-table表格插件笔记
    art-template笔记
  • 原文地址:https://www.cnblogs.com/qixianchuan/p/11162748.html
Copyright © 2020-2023  润新知