1<!DOCTYPEhtml>2<!ここから>3<html>4<body>5<linkrel="stylesheet"type="text/css"href="style.css">6<scripttype="text/javascript"src="script.js"></script>7<!ここまで追加>8<divclass="overlay-navigation">9<navrole="navigation">10<ul>11<li><ahref="#"data-content="The beginning">Home</a></li>12<li><ahref="#"data-content="Curious?">About</a></li>13<li><ahref="#"data-content="I got game">Skills</a></li>14<li><ahref="#"data-content="Only the finest">Works</a></li>15<li><ahref="#"data-content="Don't hesitate">Contact</a></li>16</ul>17</nav>18</div>1920<sectionclass="home">21<ahref="http://codepen.io/fluxus/pen/gPWxXJ"target="_blank">Click for CSS version</a>22<divclass="open-overlay">23<spanclass="bar-top"></span>24<spanclass="bar-middle"></span>25<spanclass="bar-bottom"></span>26</div>27</section>28<!ここから>29</body>30</html>31<!ここまで追加>
1<!DOCTYPEhtml>2<html>3<body>4<scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>5<scriptsrc="http://julian.com/research/velocity/build/jquery.velocity.min.js"></script>6<scriptsrc="http://julian.com/research/velocity/build/velocity.ui.js"></script>7<linkrel="stylesheet"type="text/css"href="style.css">8<scripttype="text/javascript"src="script.js"></script>9<divclass="overlay-navigation">10<navrole="navigation">11<ul>12<li><ahref="#"data-content="The beginning">Home</a></li>13<li><ahref="#"data-content="Curious?">About</a></li>14<li><ahref="#"data-content="I got game">Skills</a></li>15<li><ahref="#"data-content="Only the finest">Works</a></li>16<li><ahref="#"data-content="Don't hesitate">Contact</a></li>17</ul>18</nav>19</div>2021<sectionclass="home">22<ahref="http://codepen.io/fluxus/pen/gPWxXJ"target="_blank">Click for CSS version</a>23<divclass="open-overlay">24<spanclass="bar-top"></span>25<spanclass="bar-middle"></span>26<spanclass="bar-bottom"></span>27</div>28</section>29</body>30</html>31
javaScript
1$(function(){2$('.open-overlay').click(function(){3$('.open-overlay').css('pointer-events','none');4var overlay_navigation =$('.overlay-navigation'),5 top_bar =$('.bar-top'),6 middle_bar =$('.bar-middle'),7 bottom_bar =$('.bar-bottom');89 overlay_navigation.toggleClass('overlay-active');10if(overlay_navigation.hasClass('overlay-active')){1112 top_bar.removeClass('animate-out-top-bar').addClass('animate-top-bar');13 middle_bar.removeClass('animate-out-middle-bar').addClass('animate-middle-bar');14 bottom_bar.removeClass('animate-out-bottom-bar').addClass('animate-bottom-bar');15 overlay_navigation.removeClass('overlay-slide-up').addClass('overlay-slide-down')16 overlay_navigation.velocity('transition.slideLeftIn',{17 duration:300,18 delay:0,19begin:function(){20$('nav ul li').velocity('transition.perspectiveLeftIn',{21 stagger:150,22 delay:0,23complete:function(){24$('nav ul li a').velocity({25 opacity:[1,0],26},{27 delay:10,28 duration:14029});30$('.open-overlay').css('pointer-events','auto');31}32})33}34})3536}else{37$('.open-overlay').css('pointer-events','none');38 top_bar.removeClass('animate-top-bar').addClass('animate-out-top-bar');39 middle_bar.removeClass('animate-middle-bar').addClass('animate-out-middle-bar');40 bottom_bar.removeClass('animate-bottom-bar').addClass('animate-out-bottom-bar');41 overlay_navigation.removeClass('overlay-slide-down').addClass('overlay-slide-up')42$('nav ul li').velocity('transition.perspectiveRightOut',{43 stagger:150,44 delay:0,45complete:function(){46 overlay_navigation.velocity('transition.fadeOut',{47 delay:0,48 duration:300,49complete:function(){50$('nav ul li a').velocity({51 opacity:[0,1],52},{53 delay:0,54 duration:5055});56$('.open-overlay').css('pointer-events','auto');57}58});59}60})61}62})63});