国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jq實現(xiàn)左滑顯示刪除按鈕,點擊刪除實現(xiàn)刪除數(shù)據(jù)功能(推薦)

2019-11-20 09:10:32
字體:
來源:轉載
供稿:網(wǎng)友

效果圖

第一步:加載

<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>

以上這篇jq實現(xiàn)左滑顯示刪除按鈕,點擊刪除實現(xiàn)刪除數(shù)據(jù)功能(推薦)就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網(wǎng)。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 江门市| 中山市| 峨眉山市| 吉水县| 永泰县| 股票| 巴青县| 泰来县| 天水市| 佛山市| 赣州市| 易门县| 任丘市| 宜州市| 惠东县| 江川县| 工布江达县| 理塘县| 义马市| 泰宁县| 伊金霍洛旗| 马公市| 荔浦县| 景东| 盱眙县| 沂水县| 封开县| 孝感市| 剑河县| 新泰市| 巴彦淖尔市| 涿鹿县| 湘西| 林周县| 崇左市| 台北县| 家居| 大田县| 靖宇县| 永城市| 乌兰察布市|