jq实现左滑显示删除按钮,点击删除实现删除数据
来源:互联网 发布:万能搞笑证件制作软件 编辑:程序博客网 时间:2024/06/05 20:10
效果图
第一步:加载
<script src="js/jquery.min.js"></script><script src="js/jquery.mobile-1.3.2.min.js"></script>
第二步:html
<div class="item-wrap"> <div class="item clearfix"> <div class="img-item"> <img src="images/icon.png"> </div> <div class="txt-item"> <p class="name"> 小黄人 </p> <p class="txt"> 小黄人小黄人小黄人小黄人 </p> </div> <i class="arrow"></i> <a class="delect-btn">删除</a> </div> <div class="item clearfix"> <div class="img-item"> <img src="images/icon.png"> </div> <div class="txt-item"> <p class="name"> 小黄人 </p> <p class="txt"> 小黄人小黄人小黄人小黄人 </p> </div> <i class="arrow"></i> <a class="delect-btn">删除</a> </div></div>
第二步:css
.item-wrap{ overflow: hidden; } .item-wrap .item{ border-bottom: 1px #fff solid; background: #000; width: 125%; overflow: hidden; position: relative; display: -webkit-box; -webkit-transition: all 0.3s linear; } .item-wrap .item .img-item{ width: 50px; height: 50px; margin: 10px; } .item-wrap .item .img-item img{ width: 100%; border-radius: 50%; } .item-wrap .item .txt-item{ padding-top: 10px; margin-right:25px; font-size: 14px; line-height: 24px; color: #fff; -webkit-box-flex:1; }.item-wrap .item .arrow{ width: 0; height: 0; line-height: 0; font-size: 0; border-style: solid; border-color: transparent transparent transparent #fff; border-width: 8px 0px 8px 8px; position: absolute; right: 22%; top: 50%; margin-top: -8px;}.delect-btn{ width: 20%; margin-left: 15px; color: #fff; background: #0f0; z-index:999; display: block; text-align: center; padding-top: 5%;}.item-wrap .selected{ -webkit-transform: translate(-16%); -webkit-transition: all 0.3s linear;}
第二步:jq
<script> $(".item").on('swipeleft', function(event) { event.preventDefault(); /* Act on the event */ $(this).addClass('selected').siblings('.item').removeClass('selected'); $(this).find('.delect-btn').on('click', function(event) { event.preventDefault(); /* Act on the event */ $(this).parent(".item").animate({ height: 0, width: 0}, 300, function() { /* stuff to do after animation is complete */ $(this).remove(); }); }); }); $(".item").on('swiperight', function(event) { event.preventDefault(); /* Act on the event */ $(this).removeClass('selected'); });</script>
0 0
- jq实现左滑显示删除按钮,点击删除实现删除数据
- 高仿微信实现左滑显示删除按钮功能
- jq实现点击添加和删除一行
- android 左滑显示删除按钮SwipeMenuListView
- tableView cell 左滑点击删除等点击按钮
- Js实现点击按钮创建删除div
- 点击网页“删除”按钮实现删除数据库中的内容
- iOS tableviewcell左划自定义(带图片)删除按钮,点击任意地方取消删除的巧妙实现方法
- 自定义SwipeLayout控件实现ListView条目侧滑出现删除按钮,点击实现删除ListView条目
- 动态的把数据显示在table中,点击某一行的删除按钮实现该行的删除(通过ajax实现页面的无刷新加载)
- 动态的把数据显示在table中,点击某一行的删除按钮实现该行的删除(通过ajax实现页面的无刷新加载)
- jq ajax 实现批量删除
- 实现cell显示一个删除按钮
- repeater实现删除按钮
- repeater实现删除按钮
- repeater实现删除按钮
- ViewDragHelper 实现 ListView 左滑删除
- 自定义实现ListView左滑删除
- [PAT (Advanced Level) ]1081. Rational Sum 解题文档
- 第七周项目3负数把正数赶出队列
- Android-Universal-Image-Loader 图片异步加载类库的使用(超详细配置)
- Android动画之二:View Animation
- 结合Scikit-learn介绍几种常用的特征选择方法
- jq实现左滑显示删除按钮,点击删除实现删除数据
- 统计一个字符串在另一个字符串中出现的个数
- map字符串转json字符串,转map对象
- POJ 1423 Big Number
- Sql Server 死锁的解除方法
- 使用JMeter进行性能测试之Java请求
- OSI模型之网络层概述
- 使用MyEclipse14把Java web项目打成war包
- DBCP数据源