slide_61bdbfd.js
1.37 KB
define("modules/js/slide",function(n){var i=n("modules/lib/jquery"),o={paddingTop:i("#nav").height()+1,rang:["home","about","course","contact"],highLight:function(){for(var n=i(document).scrollTop()+this.paddingTop+1,o=this.rang.length-1,t=o;t>=0;t--){var a=i("#"+this.rang[t]+"-section").offset().top;if(n>a){i("#nav").find("a").parent().removeClass("current"),i(".nav-"+this.rang[t]).parent().addClass("current");break}}var e=i(document).scrollTop()>200?.8:0;i("#nav").find(".nav-bg").stop().animate({opacity:e},{duration:100}),this.$mouse.stop().animate({opacity:i(document).scrollTop()+i(window).height()>900?0:1},{duration:100})},scroll:function(n){i(document.body).animate({scrollTop:n},{duration:500})},bindEvents:function(){var n=this;i(window).on("resize",function(){i(window).width()>900&&i("#nav").find("ul.nav-ul").removeClass("on-active"),n.paddingTop=i("#nav").height()+1}),i("#nav").on("click","a",function(n){var t=i(this).attr("href");t&&"#"===t.charAt(0)&&o.scroll(i(t).offset().top-o.paddingTop),n.preventDefault()}).on("click",".navbar-toggle",function(){i("#nav").find("ul.nav-ul").toggleClass("on-active")}).on("click",".nav-ul li",function(){i("#nav").find("ul.nav-ul").removeClass("on-active")});var n=this;i(window).on("scroll",function(){n.highLight()})},init:function(){this.$mouse=i("#home-section").find(".mouse"),this.highLight(),this.bindEvents()}};i(function(){o.init()})});