zoukankan      html  css  js  c++  java
  • 触屏版类似刷新页面文本框获取焦点的同时弹出手机键盘的做法

    手机触屏版想要自动弹出键盘要满足的三个条件:

    1、文本框获取焦点

    2、手触屏该页面的屏幕

    3、无延迟

    实现实例(类似微信微博):

    <!DOCTYPE html>
    <html lang="zh-cn">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <style>
        .page{
            100%;
            height:400px;
            background:#333;
            overflow:hidden;
        }
        .page a{
            display: block;
            50px;
            height:50px;
            margin:100px auto;
        }
        .com {
            display: none;
            100%;
            height:500px;
            overflow:hidden;
        }
        .com textarea{
            display: block;
            90%;
            height:200px;
            margin:50px auto;
        }
    </style>
    <body>
         <div class="page">
             <a href="javascript:void(0);">评论</a>
         </div>


         <div class="com">
             <textarea></textarea>
         </div>
    </body>
    <script>
          $('.page a').on('click',function(){
              $('.page').hide()
              $('.com').show()
              $('.com textarea').focus()
          })
          
    </script>

    </html>

  • 相关阅读:
    Java关键字instanceof
    java中equals和==的区别
    Servlet、Filter、Listener总结
    struts2 拦截器配置
    Struts2技术详解
    构建Java并发模型框架
    基于MINA框架快速开发网络应用程序
    Spring的IOC原理
    Spring AOP原理及拦截器
    JAVA三大框架SSH和MVC
  • 原文地址:https://www.cnblogs.com/dearxinli/p/4493605.html
Copyright © 2011-2022 走看看