swiperLeft/swiperRight以及js长按事件
来源:互联网 发布:开源的数据库审核平台 编辑:程序博客网 时间:2024/04/29 21:55
<script src="../../style/js/jquery.min.js"></script>
<script src="../../style/expand/jquery.event.move.js"></script>
<script src="../../style/expand/jquery.event.swipe.js"></script>
<style type="text/css">
.list-container{min-height:0rem;overflow:hidden;margin-top:10rem;background:#fff;}
.list-container > li{background: #ffffff;margin-bottom:2px;display:block;overflow: hidden;height:9rem;line-height:9rem;border-top: 0.2rem solid #d8d8d8;font-size:3rem;}
.list-container> li a{position: relative;height:9rem;display: inline-block;width: 100%;float: left;}
.logText{text-indent:3rem;width:70%;display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.logTime{padding-right:3rem;display:inline-block;float:right;}
.list-container li > span{display:inline-block;width:150px;background:red;height:9rem;text-align:center;line-height:9rem;}
</style>
</head>
<body>
<ul class="list-container">
<li id="2007">
<a href="#"><span class="logText">哈哈是啊撒是打发啊发撒地方阿斯顿发生的发撒地方阿斯顿发生的发撒地方暗示法打速度发V阿斯顿发撒话</span><span class="logTime">2014-6-12</span></a>
<span class="logDel" onclick="del(this)">删除</span>
</li>
</ul>
</body>
</html>
<script>
function swiperLi(){
var cont=$(".list-container li");
cont.on('swipeleft', function(e) {$(this).find("a").css("margin-left",-150);});
cont.on('swiperight', function(e){$(this).find("a").css("margin-left",0);});
}
swiperLi();
</script>
手机端js模拟长按事件(代码仿照jQuery)
代码编写:
1
2
3
4
5
6
7
8
9
10
11
12
$.fn.longPress =
function
(fn) {
var
timeout = undefined;
var
$
this
=
this
;
for
(
var
i = 0;i<$
this
.length;i++){
$
this
[i].addEventListener(
'touchstart'
,
function
(event) {
timeout = setTimeout(fn, 800);
},
false
);
$
this
[i].addEventListener(
'touchend'
,
function
(event) {
clearTimeout(timeout);
},
false
);
}
}
代码使用:
1
2
3
$(select).longPress(
function
(){
alert(1);
});
0 0
- swiperLeft/swiperRight以及js长按事件
- 长按鼠标事件js
- 长按鼠标事件js
- [Cocos2d-js]长按按钮事件
- JS-鼠标长按触发事件
- JS-手机长按点击事件
- 手机端js模拟长按事件(jQuery)
- android长按home键源码分析以及模拟长按home事件--弹出近期任务
- android长按home键源码分析以及模拟长按home事件--弹出近期任务.
- android 长按事件
- ios长按事件
- ExpandableListView 长按事件
- 长按事件
- ExpandableListView长按事件
- NGUI长按事件
- OnLongClickListener长按事件
- OnPress长按事件
- HTML5-长按事件
- 处理vmware workstation桥接不通
- SpringMVC与SiteMesh2.4无缝整合并借助JSR303规范实现表单验证
- go语言25个关键字总结
- 5个Android开发中比较常见的内存泄漏问题及解决办法
- MySQL审计之General log
- swiperLeft/swiperRight以及js长按事件
- goLang 特殊符号优先级表
- 网络编程
- Photos Framework 新照片框架
- JavaWeb企业实训 简易股市自选查询分析系统(六)使用Shiro控制登录等权限管理与Spring项目整合
- 双链表程序
- Oracle学习笔记(二十八)——pl/sql的进阶之控制结构
- django缓存优化 缓存配置与使用 - 站点 View 缓存
- Java实现Html转PDF