1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      vue.js怎么實(shí)現(xiàn)回到頂部動(dòng)畫效果-創(chuàng)新互聯(lián)

      這篇文章將為大家詳細(xì)講解有關(guān)vue.js怎么實(shí)現(xiàn)回到頂部動(dòng)畫效果,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

      創(chuàng)新互聯(lián)建站堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站制作、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的龍湖網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

      最近使用vue.js做了幾個(gè)頁面,其中有一個(gè)回到頂部的動(dòng)畫效果記錄下。

      html如下:

      
      
       
       
       回到頂部
        
        
       
       
       
       
       
       
       1
       2
       3
       4
       5
         回到  頂部  
           

      backTop.css如下:

      * {
       margin: 0px;
       padding: 0px;
       border: 0;
      }
       
      html, body {
       width: 100%;
       height: 100%;
       position: relative;
       background: #F2F2F2;
       overflow-x: hidden;
       overflow-y: auto;
       z-index: 1;
      }
       
      [v-cloak] {
       display: none;
      }
       
      .back-to-top {
       position: fixed;
       bottom: 5px;
       right: 20px;
       z-index: 100;
       border-radius: 5px;
       box-shadow: 0px 0px 2px #222;
       padding: 8px 10px;
       cursor: pointer;
      }
       
      .back-to-top:hover {
       background: #5AC4D1;
      }
       
      .back-to-top:hover span {
       color: white;
      }
       
      .back-to-top span {
       display: block;
      }
       
      .page {
       width: 100%;
       height: 400px;
       line-height: 400px;
       text-align: center;
      }
       
      .page:nth-child(odd) {
       background: white;
      }

      backTop.js 如下:

      var backTopVue = new Vue({
       el : "#back-to-top",
       data : {
       //是否顯示回到頂部
       backTopShow : false,
       // 是否允許操作返回頂部
       backTopAllow : true,
       // 返回頂部所需時(shí)間
       backSeconds : 100,
       // 往下滑動(dòng)多少顯示返回頂部(單位:px)
       showPx : 200
       },
       mounted : function() {
       window.addEventListener("scroll", this.backTopShowOperate, true);
       },
       methods : {
       backTopShowOperate : function() {
       if (!this.backTopAllow) return;
       if (document.body.scrollTop > this.showPx) {
       this.backTopShow = true;
       } else {
       this.backTopShow = false;
       }
       },
       backToTop : function() {
       if (!this.backTopAllow) return;
       this.backToTopShow = false;
       this.backTopAllow = false;
       var step = document.body.scrollTop / this.backSeconds;
       var backTopInterval = setInterval(function() {
       if (document.body.scrollTop > 0) {
       document.body.scrollTop -= step;
       } else {
       backTopVue.backTopAllow = true;
       clearInterval(backTopInterval);
       }
       }, 1);
       }
       }
      });

      關(guān)于“vue.js怎么實(shí)現(xiàn)回到頂部動(dòng)畫效果”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。


      分享名稱:vue.js怎么實(shí)現(xiàn)回到頂部動(dòng)畫效果-創(chuàng)新互聯(lián)
      當(dāng)前路徑:http://www.ef60e0e.cn/article/ddjjes.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        旬阳县| 正蓝旗| 海宁市| 邵武市| 乐亭县| 项城市| 乡城县| 绍兴县| 元谋县| 长顺县| 天镇县| 田东县| 台北县| 齐河县| 保康县| 策勒县| 南澳县| 新巴尔虎左旗| 镇雄县| 宜宾市| 黄骅市| 顺平县| 达日县| 邵东县| 塔城市| 黔西县| 西藏| 瑞安市| 临沧市| 搜索| 徐州市| 屯门区| 花莲县| 泸西县| 广河县| 新竹县| 前郭尔| 建水县| 和田市| 门头沟区| 屏南县|