This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
网址 http://blog.weiqinxue.cn/blogs/index.php/User/articleview/ArticleID/U2A155 | |
if(Q.ua.IOS){ | |
Q.$(window).on("pagehide",function(){ | |
var $body = $(document.body); | |
$body.children().remove(); // wait for this callback to finish executing and then... | |
setTimeout(function() { | |
$body.append("<script type='text/javascript'>window.location.reload(true);</script>"); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
对手机号码不识别 | |
<meta name="format-detection" content="telephone=no" /> | |
viewport | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
什么是点击穿透? | |
假如页面上有两个元素A和B。B元素在A元素之上。我们在B元素的touchstart事件上注册了一个回调函数,该回调函数的作用是隐藏B元素。我们发现,当我们点击B元素,B元素被隐藏了,随后,A元素触发了click事件。 | |
这是因为在移动端浏览器,事件执行的顺序是touchstart > touchend > click。而click事件有300ms的延迟,当touchstart事件把B元素隐藏之后,隔了300ms,浏览器触发了click事件,但是此时B元素不见了,所以该事件被派发到了A元素身上。如果A元素是一个链接,那此时页面就会意外地跳转。 | |
方案二:FastClick | |
FastClick 是 FT Labs 专门为解决移动端浏览器 300 毫秒点击延迟问题所开发的一个轻量级的库。FastClick的实现原理是在检测到touchend事件的时候,会通过DOM自定义事件立即出发模拟一个click事件,并把浏览器在300ms之后的click事件阻止掉。 | |
http://www.jianshu.com/p/6e2b68a93c88 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Tween.js | |
* t: current time(当前时间) | |
* b: beginning value(初始值) | |
* c: change in value(变化量) | |
* d: duration(持续时间) | |
* 根据 当前 运行 时间 计算 当前 时间 的 运动 位置 返回 的 是 位置 | |
*/ | |
var Tween = { | |
Linear: function(t, b, c, d) { return c*t/d + b; }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 问题描述 | |
在移动端 使用 fixed 进行 弹窗 时会 出现滚动 时 下层 的 元素 也会 滚动 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 使用普通 的方法 | |
var str="assssfdererdsdsgseres"; | |
function method1(){ | |
var str=document.getElementById("J_input").value; | |
if(str){ | |
var obj={}; | |
var num=0; |