JS運動框架-Move.js

Move.js 是一個運動的javascript庫,它支持CSS3的動畫,不過不需要用CSS3代碼去編寫,只需要用javascript編寫就可以.

  1. 第一步,首先要引入這個庫,可以去cdnsjs哪里去引入cdn外鏈點擊去搜索Move.js
    2.把它放到</body>的上面.可以可以下我放的位置.
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/move.js/0.5.0/move.js"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jQuery-slimScroll/1.3.8/jquery.slimscroll.js"></script> 
        <script src="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.6.7/jquery.fullPage.js"></script>

Move.js的好處相對于原生如下


image.png
基本方法
回調(diào)動畫

下面是我的例子,其中afterLoad 與 onLeave 是 fullPage.js下函數(shù)的配置. 詳細可以見E盤下mx/個人宣傳頁-fullpage

                    afterLoad : function(anchorLink,index){
//                      console.log('anchorLink:'+anchorLink,'index:'+index);
                        switch (index){
                            case 1:
                                move('.section1 h1').scale(1.5).end();
                                move('.section1 p').set('margin-top','5%').end(); 
                                break;
                            case 2:
                                move('.section2 h1').scale(0.7).end(function(){
                                    move('.section2 h1').scale(1.3).end();
                                });
                                move('.section2 p').set('margin-top','5%').end();
                                break;
                            case 3:
                                move('.section3 h1').scale(1.3).end();
                                move('.section3 h1').set('margin-left','auto').end();
                                move('.section3 p').set('margin-bottom','2%').end();
                                break;
                            case 4:
//                              move('.section4 img.primary1').rotate(360).end(function(){
//                                  move('.section4 img.primary2').rotate(360).end(function(){
//                                      move('.section4 img.primary3').rotate(360).end(function(){
//                                          move('.section4 h4.primary11').scale(1.2).end(function(){
//                                              move('.section4 h4.primary22').scale(1.2).end(function(){
//                                                  move('.section4 h4.primary33').scale(1.2).end();                                                    
//                                              });
//                                          });
//                                      })
//                                  });
//                              });
                                break;
                            default:
                                break;
                        }
                    },
                onLeave : function (index,nextIndex,direction){
                        switch (index){
                            case 1:
                                move('.section1 h1').scale(1).end();
                                move('.section1 p').set('margin-top','800px').end(); 
                                break;
                            case 2:
                                move('.section2 h1').scale(1).end();
                                move('.section2 h1').set('opacity','0.8').end(); 
                                move('.section2 p').set('margin-top','800px').end();
                                break;
                            case 3:
                                move('.section3 h1').scale(1).end();
                                move('.section3 h1').set('margin-left','-1500px').end();
                                move('.section3 p').set('margin-bottom','-1500px').end();
                                break;
                            case 4:
//                              move('.section4 img.primary1').rotate(-360).end();
//                                  move('.section4 img.primary2').rotate(-360).end();
//                                      move('.section4 img.primary3').rotate(-360).end();
//                                          move('.section4 h4.primary11').scale(1).end();
//                                              move('.section4 h4.primary22').scale(1).end();
//                                                  move('.section4 h4.primary33').scale(1).end();                                                  
                            
                                break;
                            default:
                                break;
                        }
                    },

如果想了解更多請加我的qq 739367755

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 最近在逛各大網(wǎng)站,論壇,以及像SegmentFault等編程問答社區(qū),發(fā)現(xiàn)Vue.js異?;鸨貜托缘奶釂柡蛢?nèi)容...
    忘川慕白閱讀 6,133評論 7 113
  • 1、通過CocoaPods安裝項目名稱項目信息 AFNetworking網(wǎng)絡(luò)請求組件 FMDB本地數(shù)據(jù)庫組件 SD...
    陽明AI閱讀 16,201評論 3 119
  • 愛情里最好的模樣,便是攜手白頭,恩愛永終,思念里最好的模樣便是雖只字未提,但深情已至。。 在古代文人墨客口中,愛情...
    豐錦溪閱讀 569評論 0 0
  • 文|執(zhí)直之智 曾姓,中華姓氏之一。 鄫國,夏之同姓、淮泗諸侯。傳國三代,滅于莒國。故城之墟,位于山東蒼山,...
    執(zhí)直之智閱讀 3,880評論 0 2
  • 下午我和林處去交通局開會,回來的路上,我主動跟林處聊天,第一次跟林處接觸,也不知道說什么好,看起來我們年齡好...
    不忘初心堅持到底閱讀 520評論 0 1

友情鏈接更多精彩內(nèi)容