js document.activeElement及使用
// 解决键盘弹出后挡表单的问题
// 解决键盘弹出后挡表单的问题
window.addEventListener('resize', function() {
if(
document.activeElement.tagName === 'INPUT' ||
document.activeElement.tagName === 'TEXTAREA'
) {
window.setTimeout(function() {
if('scrollIntoView' in document.activeElement) {
document.activeElement.scrollIntoView();
} else {
document.activeElement.scrollIntoViewIfNeeded();
}
}, 0);
}
});
document.activeElement 的支持程度,发现四大浏览器safari除外, ie firefoxopera都提供了这个对象的支持。但是有点需要注意的,上面的例子中 opera 会把图片作为 可以 focus的对象。导致document.activeElement的结果不一致...
js document.activeElement及使用的更多相关文章
- js document.activeElement 获得焦点的元素
<body> <input type="text" id="test" value="ajanuw"> <sc ...
- document.activeElement 过滤选择文件弹窗导致的页面失焦
在线考试页面,常常需要检测用户是否作弊. 一般是监听页面是否失焦的方式,而失焦的方式有很多种,比如QQ弹窗,切换页面,切换程序,input文件上传选择文件等 选择文件是正常情况,这种情况下需要过滤 本 ...
- HTML:document.activeElement
今天遇到一个很郁闷的问题: document.activeElement获取当前获得焦点的元素,在chrome总是得到body,后来经过试验得到结果如下: document.activeElement ...
- js & document.designMode
js & document.designMode js 一键开启页面编辑模式 var mode = document.designMode; document.designMode = val ...
- js & document.execCommand
js & document.execCommand click copy document.execCommand 已废弃 过时的 此功能已过时.尽管它可能在某些浏览器中仍然可以使用,但不建议 ...
- JS document 获取 html对象的问题
在了解document.getElementById()方法的时候,没有留意到被获取的对象的声明时的位置, 一个很基础很细节的问题. 比如说 这个js的引入位置: -----------------a ...
- JS ——document、“或”、event(事件对象)
1.document <document>是所以HTML的最高节点,比<html>的等级还要高. <document>的第一个子节点是“!”——document.c ...
- JS document.execCommand实现复制功能(带你出坑)
最近项目中需要实现功能:点击button,复制input框的值: 我使用的是 document.execCommand('copy')的方法: 但是很郁闷的是,始终实现不了功能:代码如下 HTML代码 ...
- js document.load 和 document.ready 区别
document.ready和onload的区别——JavaScript文档加载完成事件 页面加载完成有两种事件 一是ready,表示文档结构已经加载完成(不包含图片等非文字媒体文件) 二是onloa ...
随机推荐
- WPF 自定义事件
1.可传参数 namespace DrugInfo { public class ChooseDrugRoutedEventArgs : RoutedEventArgs { public Choose ...
- C++的虚函数试题,常考!!
#include <iostream> #include <cstring> #include <string.h> #include <stdio.h> ...
- [转]bigdecimal 保留小数位
原文地址:https://www.cnblogs.com/liqforstudy/p/5652517.html public class test1_format { public static vo ...
- Laravel Eloquent使用小记
原文地址:http://blog.onlywan.cc/14843810761202.html Laravel Eloquent使用小记 今天由于开发数据库业务中间层须要.開始研究Laravel El ...
- thinkphp验证码乱码的解决办法
很有可能是入口文件index.php和.htaccess文件要转换成 以UTF-8无BOM格式编码
- 引用Interop.SQLDMO.dll后的注意事项。
SQLDMO.dll是个好东西,ASP.NET利用它可以实现在线备份.还原数据库等各种功能.近日有客户要求为其在后台添加一个管理数据库的功能.于是就出现了这篇文章. 由于客户的数据库和WEB服 ...
- 【Unity笔记】寻路导航用NavMeshObstacle做动态阻挡
通常情况下,静态的场景中,给场景物体静态标记中勾选Navigation Static后,在导航界面进行导航网格的烘培,可以得到一个静态的导航网格. 但是由于导航网格是静态烘焙好了的,游戏中动态生成的物 ...
- CAS (14) —— CAS 更多用户信息
CAS (14) -- CAS 更多用户信息 摘要 将更多用户信息写入到service验证返回消息中 版本 tomcat版本: tomcat-8.0.29 jdk版本: jdk1.8.0_65 cas ...
- Access restriction: The method typeNameToClass(String) from the type ObjectHandler is not accessible due to restriction on required library
异常: Access restriction: The method typeNameToClass(String) from the type ObjectHandler is not access ...
- Parse how to write flash in uefi shell.
Step: 1. Enable 2. Read 3. Write 4. Disable FI_GUID gEfiSFlashProtocolGuid = FLASH_P ...