免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

jQuery如何實現(xiàn)移動端下拉展現(xiàn)新的內(nèi)容回彈動畫-創(chuàng)新互聯(lián)

創(chuàng)新互聯(lián)www.cdcxhl.cn八線動態(tài)BGP香港云服務(wù)器提供商,新人活動買多久送多久,劃算不套路!

專注于為中小企業(yè)提供網(wǎng)站制作、成都網(wǎng)站建設(shè)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)盧氏免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了1000+企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

這篇文章將為大家詳細(xì)講解有關(guān)jQuery如何實現(xiàn)移動端下拉展現(xiàn)新的內(nèi)容回彈動畫,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

jquery的方法,寫的比較細(xì),可以改成原生的這里就不做修改了, 話不多說上代碼, 也可以改成下拉刷新

<!DOCTYPE html>
<html>
 <head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
 <title>頂部回彈</title>
 <style type="text/css">
 html,body,div,h3{ margin: 0;padding: 0;}
 html,body { width: 100%;height: 100%;overflow: hidden; }
 .wrap { width: 100%;height: 100%;overflow: hidden;position: relative; }
 .hideBox { width: 100%;height: 100%;background-color: #f5f5f5;position: absolute;top: 0;left: 0;overflow-y: auto;}
 .hideBox h3 { width: 100%;margin-top: 20%;font-size: 16px;text-align: center; }
 
 .top { width: 100%;height: 100%; position: absolute; top: 0;left: 0;z-index: 2;background-color: #fff;overflow-y: auto;text-align: center;}
 .moveBox {background-color: #1a84dd;color: #fff;width: 100px;height: 100px;text-align: center;line-height: 100px;border-radius: 50%;cursor: pointer; -webkit-user-select: none;-moz-user-select: none;margin: 0 auto;}
 .moveIn { transition: all 1s ease-in; }
 </style>
 </head>
 <body>
 <div class="wrap" >
 <div class="hideBox" >
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3> 
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 <h3>這是隱藏層的內(nèi)容</h3>
 </div>
 <div class="top" >
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 <div class="moveBox" >移動塊</div>
 </div>
 </div>
 </body>
 <script src="https://cdn.bootcss.com/jquery/2.1.4/jquery.min.js" type="text/javascript" charset="utf-8"></script>
 <script type="text/javascript">
 $(function(){
 moveBoxFun($(".top"));
 }) 
 // 移動方法
 function moveBoxFun(dome){
 var startY,endY,intY,
 maxH = $(window).height(),
 maxY = maxH*0.6; // 手指移動的距離
 if(dome){
 
 dome.on('touchstart',function(e){
  var touchS = e.originalEvent.targetTouches[0];
  var startY = touchS.clientY; // 鼠標(biāo)相對瀏覽器窗口高度 
  // 獲取當(dāng)前元素scrollTop 
  var scrollTop = dome.scrollTop();
  // 不在頂部禁止
  if(scrollTop !== 0){
  dome.css({top:0});
  dome.unbind('touchmove');
  return;
  }
  // 移動變量
  var moveY = 0;
  
  dome.on('touchmove',function(ev){
  var touchM = ev.originalEvent.targetTouches[0];  
  var mY = touchM.clientY;
  moveY+=2;
  if(mY - startY > 0){  
  dome.css({
  top: moveY+'px'
  })
  }
            // 如果刷新可以改成 window.location.reload()
  })  
  
  dome.on('touchend',function(ev){
  var touchE = ev.originalEvent.changedTouches[0];
  var endY = touchE.clientY;
  dome.unbind('mousemove');
  if(endY - startY >0&& endY - startY > maxY){
  dome.animate({
  top: maxH + 'px'
  },function(){
  dome.hide();
  })
  }else{
  dome.css({
  top:'0px'
  },200)
  }
  });  
 });
 
 }
 }
 
 </script>
</html>

名稱欄目:jQuery如何實現(xiàn)移動端下拉展現(xiàn)新的內(nèi)容回彈動畫-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://newbst.com/article44/dipjhe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計App設(shè)計微信公眾號手機(jī)網(wǎng)站建設(shè)小程序開發(fā)微信小程序

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司