js实现IOS上删除app时颤抖动画j函数
欢迎提供更好的方法!
<!--http://www.cnblogs.com/webzhangnan/p/3244920.html -->
<html>
<head>
<title>IOS shake by conan</title>
<style type="text/css">
.box{
display: -webkit-box;
padding: 20px;
}
.icon{
height: 100px;
width: 100px;
margin: 20px;
background: red;
}
#start{
width: 200px;
height: 60px;
line-height: 60px;
text-align: center;
margin: 10px;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<div class="box">
<div class="icon"></div>
<div class="icon"></div>
<div class="icon"></div>
<div class="icon"></div>
</div>
<div id="start">run shake</div>
<script type="text/javascript">
shake = function($item) {
if ($item.length) {
var timeIdAry = [] , len = $item.length;
while(len--) timeIdAry.push(shake($item[len]));
return function() {
var stop;
while (stop = timeIdAry.shift()) {
stop();
}
}
} else {
var timeId, runing = true,
duration = '-webkit-transition: -webkit-transform 100ms;',
d = false;
var loop = function() {
if (!runing) return;
if(!$item.getAttribute('pause'))
$item.style.cssText = duration + '-webkit-transform: translate3d(' + (d ? 0 : 0) + 'px,' + (d ? 0 : 0) + 'px, 0) rotate(' + (d ? -1 : 1) + 'deg);-webkit-transform-origin: '+(d ? 20 : 80) + '% ' + (d ? 80 : 20) + '%'
d = !d;
timeId = setTimeout(loop, 100);
}
loop();
return function() {
clearTimeout(timeId);
$item.setAttribute('style', '');
delete $item;
loop = null;
itemId = runing = null;
}
}
}
var icons = document.querySelectorAll('.icon');
var stop;
document.querySelector('#start').addEventListener('click', function(){
if(stop) stop(),stop=null,this.innerHTML = 'run shake';
else stop = shake(icons), this.innerHTML = 'kill shake';
}); var s = icons.length , EV = 'ontouchstart' in window ? {start : 'touchstart',end:'touchend'} : {start : 'mouseover',end:'mouseout'};
while(s--){
icons[s].addEventListener(EV.start, function(e){
e.target.setAttribute('pause', 1);
e.target.setAttribute('style', '-webkit-transform: scale(1.5);-webkit-transition: -webkit-transform 100ms;opacity:.5');
});
icons[s].addEventListener(EV.end, function(e){
e.target.setAttribute('pause', '');
});
}
</script> </body>
</html>
js实现IOS上删除app时颤抖动画j函数的更多相关文章
- 上传App时遇IDFA错误问题
今天上传App时遇到下图1的情况,很纳闷,又是苹果新规. 通常是第三方的库引起啦,马上想到百度统计了,打开SDK下载页面看看简单介绍,里面有讲到这个问题了. 图2就是这次改动的原因. 更新SDK,之前 ...
- iOS 上传APP到AppStore 卡在 Authenticating with the iTunes store 提示
上传APP的时候,遇到了问题,一直卡在Authenticating with the iTunes store提示这里, 解决办法:在Application Loader里面登录需要上传APP的开发者 ...
- app混合开发 fastlick.js 在ios上 input标签点击 不灵敏 处理
ios11 上有这个问题 而老版本的ios没有 会出现这个的原因是使用fastclick.js点击后input没有获取焦点,所以只需要在fasyclick的源码的这个位置 可以直接在源码内搜索关键字找 ...
- iOS: 上传App到AppStore,由于Xcode上传太慢,换成Application Loader上传,速度秒传
一.遇到的遭遇 在之前的项目开发中,本人有点固执,一直采用xcode打包后再上传,结果可想而知: (1)要么上传时速度慢的跟蜗牛似的,等的我心力交瘁(不排除网络不给力的原因,公司这个吊问题快把我气疯了 ...
- iOS上传App Store报错:this action cannot be completed -22421 解决方案
最近swift项目升了xcode8,提交版本时,遇到这个: this action cannot be completed -22421 瞬间懵逼,连具体报错原因都没有,只有一个代码 22421,找了 ...
- 50.IOS上传APP问题
更新版本的时候遇到几个问题 1.ERROR ITMS-90535: "Unexpected CFBundleExecutable Key. The bundle at 'Payload/di ...
- iOS 上传App Store提示WARNING ITMS-90703错误的说明
今天上传app到appstore的时候,上传到最后一步的时候,报了一个警告: 原文如下: WARNING ITMS-90703: "Deprecated Xcode Build. Due t ...
- iOS 后台退出app时不执行applicationWillTerminate的临时解决方法
- (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release s ...
- JS判断语句 注意多句时加大括号 回调函数LODOP兼顾写法
由于C-LODOP获取一些动作函数的返回值,需要用回调函数,由于常见的使用方法是混合部署,也就是同一个页面,根据浏览器的不同,可能会走LODOP ,也可能会走C-LODOP,因此写法要坚固两种,而有些 ...
随机推荐
- Vue实例方法之事件的实现
开始 这段时间一直在看vue的源码,源码非常多和杂,所以自己结合资料和理解理出了一个主线,然后根据主线去剥离其他的一些知识点,然后将各个知识点逐一学习.这里主要是分析的Vue事件处理的实现. 正文 一 ...
- JS 根据参数是否为空进行true|false判断呢
<form id="actForm" action="${ctx}/meeting/vip/saveMeetingAttendVipAct" method ...
- bootloader的移植
jz2440开发板 在介绍bootloader里边的内容的时候,需要知道的是: bootloader的引入的目的就是启动linux内核,一个简单的bootloader编写需要以下的步骤: ①初始化硬件 ...
- Android : reletive layout
在兄弟的上下左右: android:layout_toRightOf="@id/btn1"/> android:layout_toLeftOf="@id/img1& ...
- MySQL prepare语句的SQL语法
MySQL prepare语法: PREPARE statement_name FROM preparable_SQL_statement; /*定义*/ EXECUTE statement_name ...
- next_permitation
了解一个C++ STL的函数 next_permitation 可用于生成全排列 如下例子 #include <iostream> #include <stdio.h> #in ...
- 【BZOJ3669】魔法森林(LCT)
题意:有一张无向图,每条边有两个权值.求选取一些边使1和n连通,且max(a[i])+max(b[i])最小 2<=n<=50,000 0<=m<=100,000 1<= ...
- 【ZJOI2017 Round1练习】D8T1 mushroom(点分治)
题意: 思路: num[a[u]]表示存在a[u]这个颜色且终点在u子树中的链长总和 ans[i]表示以当前的u为根,前面的子树对i的贡献之和 ..]of longint; size,f,ans,su ...
- ELK pipeline
https://www.felayman.com/articles/2017/11/24/1511527532643.html?utm_medium=hao.caibaojian.com&ut ...
- [bzoj1031][JSOI2007]字符加密Cipher_后缀数组
字符加密Cipher bzoj-1031 JSOI-2007 题目大意:题目链接. 注释:略. 想法: 后缀数组裸题啊. 后缀数组其实背下来板子之后有几个数组记住就可以了. $sa_i$表示排名为$i ...