javascript - fullpage JS animation on section -
i' m making fullpage js website , have animations in evry sections of page, , want animation play when i'm on section, know have after render option in plugin dont know how syntax make css animation play there code ( in example i'm trying animation of line of section2 play when i' m on section2)
var smallcircles= ['top','right','bottom','left','top']; $(document).ready(function() { $('#fullpage').fullpage({ anchors: ['firstpage', 'secondpage', '3rdpage', '4thpage', 'lastpage'], scrollingspeed: 1000, }); });
body { height:100%; margin:0; padding:0; overflow:hidden; } .fp-section { position: relative; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; text-align:center; } .fp-section.fp-table, .fp-slide.fp-table { display: table; table-layout:fixed; width: 100%; } .fp-tablecell { display: table-cell; vertical-align: middle; width: 100%; height: 100%; } .fp-scrollable { overflow: scroll; } .fp-notransition { -webkit-transition: none !important; transition: none !important; } #line{ position:absolute; width:340px; margin-top:20px; height:4px; background:rgba(0,0,0,1); -moz-animation-duration: 1s; -webkit-animation-duration: 1s; -moz-animation-name: slidein; -webkit-animation-name: slidein; } @-moz-keyframes slidein { { margin-left:100%; width:300% } { margin-left:0%; width:600%; } } @-webkit-keyframes slidein { { margin-left:0%; width:0% } { margin-left:0%; width:340px; } }
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> <script src="https://raw.githubusercontent.com/alvarotrigo/fullpage.js/master/jquery.fullpage.js"></script> <div id="fullpage"> <div class="section " id="accueil"> <h2>section1</h2> <p></p> </div> <div class="section" id="don"> <h2>section2</h2> <div id="line"></div> </div> <div class="section" id="tri"> <h2>3</h2> </div> <div class="section" id="recycle"> <h2>4</h2> </div> </div>
check out video: https://www.youtube.com/watch?v=qicvppi9l3m
that's ideal deal css animations, if looking javascript or jquery animations, should use callbacks provided fullpage.js such afterload
or onleave
:
$('#fullpage').fullpage({ anchors: ['firstpage', 'secondpage', 'thirdpage', 'fourthpage', 'lastpage'], afterload: function(anchorlink, index){ var loadedsection = $(this); //using index if(index == 3){ alert("section 3 ended loading"); } //using anchorlink if(anchorlink == 'secondslide'){ alert("section 2 ended loading"); } } });
Comments
Post a Comment