hammer滑动删除
2016-02-23 09:54
239 查看
使用hammer.js实现移动端常见的滑动删除效果
需先引入hammer.js和jquery.hammer.js,以此使用jquery语法来调用hammer.js插件
例子:
<body>
<ul>
<li>XXXXXX</li>
<li>删除</li>
</ul>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/hammer.min.js"></script>
<script src="js/jquery.hammer.js"></script>
<script>
//滑动删除
var ul = $('ul');
ul.hammer().bind('swipeleft',function(){
$(this).addClass('active'); //使用transition过渡写滑动动画
})
ul.hammer().bind('swiperight',function(){
$(this).removeClass('active');
})
//点击删除
$('ul li:nth-child(2)').on('click',function(){
$(this).parent('ul').remove();
})
</script>hammer.js官网:http://hammerjs.github.io/
中文文档:http://www.tuicool.com/articles/VNRjym7
需先引入hammer.js和jquery.hammer.js,以此使用jquery语法来调用hammer.js插件
例子:
<body>
<ul>
<li>XXXXXX</li>
<li>删除</li>
</ul>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/hammer.min.js"></script>
<script src="js/jquery.hammer.js"></script>
<script>
//滑动删除
var ul = $('ul');
ul.hammer().bind('swipeleft',function(){
$(this).addClass('active'); //使用transition过渡写滑动动画
})
ul.hammer().bind('swiperight',function(){
$(this).removeClass('active');
})
//点击删除
$('ul li:nth-child(2)').on('click',function(){
$(this).parent('ul').remove();
})
</script>hammer.js官网:http://hammerjs.github.io/
中文文档:http://www.tuicool.com/articles/VNRjym7
相关文章推荐
- android-pickerview-master的导入
- 使用gdi+裁剪圆形图像
- How to concatenate two matrices in Python?
- 使用UDP发送数据简单实现
- java spring mvc时间String转Date(二)
- python爬虫(抓取百度新闻列表)
- htm5移动端开发 和 pc端开发
- Fiddler 会拉弦的程序员
- Android Weak Handler:可以避免内存泄漏的Handler库
- 视图的优缺点
- 257. Binary Tree Paths
- Java transient关键字使用
- 版本号V1*.V2*.V3*.V4* 第四位从svn versioon同步
- 深度学习edusoho之前端插件
- 2016.02.23,英语,《Vocabulary Builder》Unit 01
- CocoaPods安装使用及配置私有库
- MIME协议
- CodeForces 629C Famil Door and Brackets
- easyUI-tree
- bat脚本批量输出文件夹名