-
Notifications
You must be signed in to change notification settings - Fork 3
/
jquery.fullPage.min.js
executable file
·44 lines (44 loc) · 18.7 KB
/
jquery.fullPage.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* fullPage 2.4.0
* https://github.com/alvarotrigo/fullPage.js
* MIT licensed
*
* Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo
*/
(function(a){a.fn.fullpage=function(c){function ha(){a("body").append('<div id="fp-nav"><ul></ul></div>');k=a("#fp-nav");k.css("color",c.navigationColor);k.addClass(c.navigationPosition);for(var b=0;b<a(".fp-section").length;b++){var e="";c.anchors.length&&(e=c.anchors[b]);var d=c.navigationTooltips[b];"undefined"===typeof d&&(d="");k.find("ul").append('<li data-tooltip="'+d+'"><a href="#'+e+'"><span></span></a></li>')}}function M(){a(".fp-section").each(function(){var b=a(this).find(".fp-slide");
b.length?b.each(function(){A(a(this))}):A(a(this))});a.isFunction(c.afterRender)&&c.afterRender.call(this)}function N(){if(!c.autoScrolling){var b=a(window).scrollTop(),e=0,d=Math.abs(b-a(".fp-section").first().offset().top);a(".fp-section").each(function(c){var f=Math.abs(b-a(this).offset().top);f<d&&(e=c,d=f)});var f=a(".fp-section").eq(e);if(!f.hasClass("active")){E=!0;var h=a(".fp-section.active").index(".fp-section")+1,v=F(f),l=f.data("anchor");f.addClass("active").siblings().removeClass("active");
q||(a.isFunction(c.onLeave)&&c.onLeave.call(this,h,f.index(".fp-section")+1,v),a.isFunction(c.afterLoad)&&c.afterLoad.call(this,l,f.index(".fp-section")+1));G(l);H(l,0);c.anchors.length&&!q&&(w=l,location.hash=l);clearTimeout(O);O=setTimeout(function(){E=!1},100)}c.fitSection&&(clearTimeout(P),P=setTimeout(function(){q||n(f)},1E3))}}function Q(b){return scrollable=b.find(".fp-slides").length?b.find(".fp-slide.active").find(".fp-scrollable"):b.find(".fp-scrollable")}function B(b,c){if("down"==b)var d=
"bottom",f=a.fn.fullpage.moveSectionDown;else d="top",f=a.fn.fullpage.moveSectionUp;if(0<c.length)if(d="top"===d?!c.scrollTop():"bottom"===d?c.scrollTop()+1+c.innerHeight()>=c[0].scrollHeight:void 0,d)f();else return!0;else f()}function ia(b){var e=b.originalEvent;if(!R(b.target)){c.autoScrolling&&b.preventDefault();b=a(".fp-section.active");var d=Q(b);q||t||(e=S(e),p=e.y,C=e.x,b.find(".fp-slides").length&&Math.abs(D-C)>Math.abs(r-p)?Math.abs(D-C)>a(window).width()/100*c.touchSensitivity&&(D>C?a.fn.fullpage.moveSlideRight():
a.fn.fullpage.moveSlideLeft()):c.autoScrolling&&Math.abs(r-p)>a(window).height()/100*c.touchSensitivity&&(r>p?B("down",d):p>r&&B("up",d)))}}function R(b,e){e=e||0;var d=a(b).parent();return e<c.normalScrollElementTouchThreshold&&d.is(c.normalScrollElements)?!0:e==c.normalScrollElementTouchThreshold?!1:R(d,++e)}function ja(b){b=S(b.originalEvent);r=b.y;D=b.x}function s(b){if(c.autoScrolling){b=window.event||b;b=Math.max(-1,Math.min(1,b.wheelDelta||-b.deltaY||-b.detail));var e=a(".fp-section.active"),
e=Q(e);q||(0>b?B("down",e):B("up",e));return!1}}function T(b){var e=a(".fp-section.active").find(".fp-slides");if(e.length&&!t){var d=e.find(".fp-slide.active"),f=null,f="prev"===b?d.prev(".fp-slide"):d.next(".fp-slide");if(!f.length){if(!c.loopHorizontal)return;f="prev"===b?d.siblings(":last"):d.siblings(":first")}t=!0;x(e,f)}}function U(){a(".fp-slide.active").each(function(){I(a(this))})}function n(b,e,d){var f={},h=b.position();if("undefined"!==typeof h){var h=h.top,v=F(b),l=b.data("anchor"),
g=b.index(".fp-section"),k=b.find(".fp-slide.active"),y=a(".fp-section.active"),n=y.index(".fp-section")+1;if(!y.is(b)||z){var m=z;if(k.length)var t=k.data("anchor"),s=k.index();if(c.autoScrolling&&c.continuousVertical&&"undefined"!==typeof d&&(!d&&"up"==v||d&&"down"==v)){d?a(".fp-section.active").before(y.nextAll(".fp-section")):a(".fp-section.active").after(y.prevAll(".fp-section").get().reverse());u(a(".fp-section.active").position().top);U();var p=y,h=b.position(),h=h.top,v=F(b)}b.addClass("active").siblings().removeClass("active");
q=!0;"undefined"!==typeof l&&V(s,t,l);c.autoScrolling?(f.top=-h,b="."+W):(f.scrollTop=h,b="html, body");var r=function(){p&&p.length&&(d?a(".fp-section:first").before(p):a(".fp-section:last").after(p),u(a(".fp-section.active").position().top),U());a.isFunction(c.afterLoad)&&!m&&c.afterLoad.call(this,l,g+1);setTimeout(function(){q=!1;a.isFunction(e)&&e.call(this)},600)};a.isFunction(c.onLeave)&&!m&&c.onLeave.call(this,n,g+1,v);c.css3&&c.autoScrolling?(X("translate3d(0px, -"+h+"px, 0px)",!0),setTimeout(function(){r()},
c.scrollingSpeed)):a(b).animate(f,c.scrollingSpeed,c.easing).promise().done(function(){r()});w=l;c.autoScrolling&&(G(l),H(l,g))}}}function Y(){if(!E){var b=window.location.hash.replace("#","").split("/"),a=b[0],b=b[1];if(a.length){var c="undefined"===typeof w,f="undefined"===typeof w&&"undefined"===typeof b&&!t;(a&&a!==w&&!c||f||!t&&J!=b)&&K(a,b)}}}function x(b,e){var d=e.position(),f=b.find(".fp-slidesContainer").parent(),h=e.index(),g=b.closest(".fp-section"),l=g.index(".fp-section"),k=g.data("anchor"),
p=g.find(".fp-slidesNav"),m=e.data("anchor"),q=z;if(c.onSlideLeave){var n=g.find(".fp-slide.active").index(),r;r=n==h?"none":n>h?"left":"right";q||"none"===r||a.isFunction(c.onSlideLeave)&&c.onSlideLeave.call(this,k,l+1,n,r)}e.addClass("active").siblings().removeClass("active");"undefined"===typeof m&&(m=h);c.loopHorizontal||(g.find(".fp-controlArrow.fp-prev").toggle(0!=h),g.find(".fp-controlArrow.fp-next").toggle(!e.is(":last-child")));g.hasClass("active")&&V(h,m,k);var s=function(){q||a.isFunction(c.afterSlideLoad)&&
c.afterSlideLoad.call(this,k,l+1,m,h);t=!1};c.css3?(d="translate3d(-"+d.left+"px, 0px, 0px)",b.find(".fp-slidesContainer").toggleClass("fp-easing",0<c.scrollingSpeed).css(Z(d)),setTimeout(function(){s()},c.scrollingSpeed,c.easing)):f.animate({scrollLeft:d.left},c.scrollingSpeed,c.easing,function(){s()});p.find(".active").removeClass("active");p.find("li").eq(h).find("a").addClass("active")}function $(){ka();L?"text"!==a(document.activeElement).attr("type")&&a.fn.fullpage.reBuild(!0):(clearTimeout(aa),
aa=setTimeout(function(){a.fn.fullpage.reBuild(!0)},500))}function ka(){if(c.responsive){var b=g.hasClass("fp-responsive");a(window).width()<c.responsive?b||(a.fn.fullpage.setAutoScrolling(!1),g.addClass("fp-responsive")):b&&(a.fn.fullpage.setAutoScrolling(!0),g.removeClass("fp-responsive"))}}function la(b,c){if(825>b||900>c){var d=Math.min(100*b/825,100*c/900).toFixed(2);a("body").css("font-size",d+"%")}else a("body").css("font-size","100%")}function H(b,e){c.navigation&&(a("#fp-nav").find(".active").removeClass("active"),
b?a("#fp-nav").find('a[href="#'+b+'"]').addClass("active"):a("#fp-nav").find("li").eq(e).find("a").addClass("active"))}function G(b){c.menu&&(a(c.menu).find(".active").removeClass("active"),a(c.menu).find('[data-menuanchor="'+b+'"]').addClass("active"))}function F(b){var c=a(".fp-section.active").index(".fp-section");b=b.index(".fp-section");return c>b?"up":"down"}function A(b){b.css("overflow","hidden");var a=b.closest(".fp-section"),d=b.find(".fp-scrollable");if(d.length)var f=d.get(0).scrollHeight;
else f=b.get(0).scrollHeight,c.verticalCentered&&(f=b.find(".fp-tableCell").get(0).scrollHeight);a=m-parseInt(a.css("padding-bottom"))-parseInt(a.css("padding-top"));f>a?d.length?d.css("height",a+"px").parent().css("height",a+"px"):(c.verticalCentered?b.find(".fp-tableCell").wrapInner('<div class="fp-scrollable" />'):b.wrapInner('<div class="fp-scrollable" />'),b.find(".fp-scrollable").slimScroll({allowPageScroll:!0,height:a+"px",size:"10px",alwaysVisible:!0})):ba(b);b.css("overflow","")}function ba(b){b.find(".fp-scrollable").children().first().unwrap().unwrap();
b.find(".slimScrollBar").remove();b.find(".slimScrollRail").remove()}function ca(b){b.addClass("fp-table").wrapInner('<div class="fp-tableCell" style="height:'+da(b)+'px;" />')}function da(b){var a=m;if(c.paddingTop||c.paddingBottom)a=b,a.hasClass("fp-section")||(a=b.closest(".fp-section")),b=parseInt(a.css("padding-top"))+parseInt(a.css("padding-bottom")),a=m-b;return a}function X(a,c){g.toggleClass("fp-easing",c);g.css(Z(a))}function K(b,c){"undefined"===typeof c&&(c=0);var d=isNaN(b)?a('[data-anchor="'+
b+'"]'):a(".fp-section").eq(b-1);b===w||d.hasClass("active")?ea(d,c):n(d,function(){ea(d,c)})}function ea(a,c){if("undefined"!=typeof c){var d=a.find(".fp-slides"),f=d.find('[data-anchor="'+c+'"]');f.length||(f=d.find(".fp-slide").eq(c));f.length&&x(d,f)}}function ma(a,e){a.append('<div class="fp-slidesNav"><ul></ul></div>');var d=a.find(".fp-slidesNav");d.addClass(c.slidesNavPosition);for(var f=0;f<e;f++)d.find("ul").append('<li><a href="#"><span></span></a></li>');d.css("margin-left","-"+d.width()/
2+"px");d.find("li").first().find("a").addClass("active")}function V(a,e,d){var f="";c.anchors.length&&(a?("undefined"!==typeof d&&(f=d),"undefined"===typeof e&&(e=a),J=e,location.hash=f+"/"+e):("undefined"!==typeof a&&(J=e),location.hash=d))}function na(){var a=document.createElement("p"),c,d={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(a,null);for(var f in d)void 0!==a.style[f]&&
(a.style[f]="translate3d(1px,1px,1px)",c=window.getComputedStyle(a).getPropertyValue(d[f]));document.body.removeChild(a);return void 0!==c&&0<c.length&&"none"!==c}function fa(){return window.PointerEvent?{down:"pointerdown",move:"pointermove"}:{down:"MSPointerDown",move:"MSPointerMove"}}function S(a){var c=[];window.navigator.msPointerEnabled?(c.y=a.pageY,c.x=a.pageX):(c.y=a.touches[0].pageY,c.x=a.touches[0].pageX);return c}function I(b){var e=c.scrollingSpeed;a.fn.fullpage.setScrollingSpeed(0);x(b.closest(".fp-slides"),
b);a.fn.fullpage.setScrollingSpeed(e)}function u(a){c.css3?X("translate3d(0px, -"+a+"px, 0px)",!1):g.css("top",-a)}function Z(a){return{"-webkit-transform":a,"-moz-transform":a,"-ms-transform":a,transform:a}}function oa(){u(0);a("#fp-nav, .fp-slidesNav, .fp-controlArrow").remove();a(".fp-section").css({height:"","background-color":"",padding:""});a(".fp-slide").css({width:""});g.css({height:"",position:"","-ms-touch-action":"","touch-action":""});a(".fp-section, .fp-slide").each(function(){ba(a(this));
a(this).removeClass("fp-table active")});g.find(".fp-easing").removeClass("fp-easing");g.find(".fp-tableCell, .fp-slidesContainer, .fp-slides").each(function(){a(this).replaceWith(this.childNodes)});a("html, body").scrollTop(0)}c=a.extend({verticalCentered:!0,resize:!0,sectionsColor:[],anchors:[],scrollingSpeed:700,easing:"easeInQuart",menu:!1,navigation:!1,navigationPosition:"right",navigationColor:"#000",navigationTooltips:[],slidesNavigation:!1,slidesNavPosition:"bottom",controlArrowColor:"#fff",
loopBottom:!1,loopTop:!1,loopHorizontal:!0,autoScrolling:!0,fitSection:!1,scrollOverflow:!1,css3:!1,paddingTop:0,paddingBottom:0,fixedElements:null,normalScrollElements:null,keyboardScrolling:!0,touchSensitivity:5,continuousVertical:!1,animateAnchor:!0,normalScrollElementTouchThreshold:5,sectionSelector:".section",slideSelector:".slide",responsive:0,afterLoad:null,onLeave:null,afterRender:null,afterResize:null,afterReBuild:null,afterSlideLoad:null,onSlideLeave:null},c);c.continuousVertical&&(c.loopTop||
c.loopBottom)&&(c.continuousVertical=!1,console&&console.log&&console.log("Option loopTop/loopBottom is mutually exclusive with continuousVertical; continuousVertical disabled"));a.fn.fullpage.setAutoScrolling=function(b){c.autoScrolling=b;b=a(".fp-section.active");c.autoScrolling?(a("html, body").css({overflow:"hidden",height:"100%"}),g.css({"-ms-touch-action":"none","touch-action":"none"}),b.length&&u(b.position().top)):(a("html, body").css({overflow:"visible",height:"initial"}),g.css({"-ms-touch-action":"",
"touch-action":""}),u(0),a("html, body").scrollTop(b.position().top))};a.fn.fullpage.setScrollingSpeed=function(a){c.scrollingSpeed=a};a.fn.fullpage.setMouseWheelScrolling=function(a){a?document.addEventListener?(document.addEventListener("mousewheel",s,!1),document.addEventListener("wheel",s,!1)):document.attachEvent("onmousewheel",s):document.addEventListener?(document.removeEventListener("mousewheel",s,!1),document.removeEventListener("wheel",s,!1)):document.detachEvent("onmousewheel",s)};a.fn.fullpage.setAllowScrolling=
function(b){if(b){if(a.fn.fullpage.setMouseWheelScrolling(!0),L||ga)MSPointer=fa(),a(document).off("touchstart "+MSPointer.down).on("touchstart "+MSPointer.down,ja),a(document).off("touchmove "+MSPointer.move).on("touchmove "+MSPointer.move,ia)}else if(a.fn.fullpage.setMouseWheelScrolling(!1),L||ga)MSPointer=fa(),a(document).off("touchstart "+MSPointer.down),a(document).off("touchmove "+MSPointer.move)};a.fn.fullpage.setKeyboardScrolling=function(a){c.keyboardScrolling=a};a.fn.fullpage.moveSectionUp=
function(){var b=a(".fp-section.active").prev(".fp-section");b.length||!c.loopTop&&!c.continuousVertical||(b=a(".fp-section").last());b.length&&n(b,null,!0)};a.fn.fullpage.moveSectionDown=function(){var b=a(".fp-section.active").next(".fp-section");b.length||!c.loopBottom&&!c.continuousVertical||(b=a(".fp-section").first());b.length&&n(b,null,!1)};a.fn.fullpage.moveTo=function(b,c){var d="",d=isNaN(b)?a('[data-anchor="'+b+'"]'):a(".fp-section").eq(b-1);"undefined"!==typeof c?K(b,c):0<d.length&&n(d)};
a.fn.fullpage.moveSlideRight=function(){T("next")};a.fn.fullpage.moveSlideLeft=function(){T("prev")};a.fn.fullpage.reBuild=function(b){z=!0;var e=a(window).width();m=a(window).height();c.resize&&la(m,e);a(".fp-section").each(function(){parseInt(a(this).css("padding-bottom"));parseInt(a(this).css("padding-top"));c.verticalCentered&&a(this).find(".fp-tableCell").css("height",da(a(this))+"px");a(this).css("height",m+"px");if(c.scrollOverflow){var b=a(this).find(".fp-slide");b.length?b.each(function(){A(a(this))}):
A(a(this))}b=a(this).find(".fp-slides");b.length&&x(b,b.find(".fp-slide.active"))});a(".fp-section.active").position();e=a(".fp-section.active");e.index(".fp-section")&&n(e);z=!1;a.isFunction(c.afterResize)&&b&&c.afterResize.call(this);a.isFunction(c.afterReBuild)&&!b&&c.afterReBuild.call(this)};var t=!1,L=navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|Windows Phone|Tizen|Bada)/),ga="ontouchstart"in window||0<navigator.msMaxTouchPoints,g=a(this),m=a(window).height(),q=!1,z=!1,
w,J,k,W="fullpage-wrapper";a.fn.fullpage.setAllowScrolling(!0);c.css3&&(c.css3=na());a(this).length?(g.css({height:"100%",position:"relative"}),g.addClass(W)):console.error("Error! Fullpage.js needs to be initialized with a selector. For example: $('#myContainer').fullpage();");a(c.sectionSelector).each(function(){a(this).addClass("fp-section")});a(c.slideSelector).each(function(){a(this).addClass("fp-slide")});c.navigation&&ha();a(".fp-section").each(function(b){var e=a(this),d=a(this).find(".fp-slide"),
f=d.length;b||0!==a(".fp-section.active").length||a(this).addClass("active");a(this).css("height",m+"px");(c.paddingTop||c.paddingBottom)&&a(this).css("padding",c.paddingTop+" 0 "+c.paddingBottom+" 0");"undefined"!==typeof c.sectionsColor[b]&&a(this).css("background-color",c.sectionsColor[b]);"undefined"!==typeof c.anchors[b]&&a(this).attr("data-anchor",c.anchors[b]);if(1<f){b=100*f;var g=100/f;d.wrapAll('<div class="fp-slidesContainer" />');d.parent().wrap('<div class="fp-slides" />');a(this).find(".fp-slidesContainer").css("width",
b+"%");a(this).find(".fp-slides").after('<div class="fp-controlArrow fp-prev"></div><div class="fp-controlArrow fp-next"></div>');"#fff"!=c.controlArrowColor&&(a(this).find(".fp-controlArrow.fp-next").css("border-color","transparent transparent transparent "+c.controlArrowColor),a(this).find(".fp-controlArrow.fp-prev").css("border-color","transparent "+c.controlArrowColor+" transparent transparent"));c.loopHorizontal||a(this).find(".fp-controlArrow.fp-prev").hide();c.slidesNavigation&&ma(a(this),
f);d.each(function(b){a(this).css("width",g+"%");c.verticalCentered&&ca(a(this))});e=e.find(".fp-slide.active");0==e.length?d.eq(0).addClass("active"):I(e)}else c.verticalCentered&&ca(a(this))}).promise().done(function(){a.fn.fullpage.setAutoScrolling(c.autoScrolling);var b=a(".fp-section.active").find(".fp-slide.active");b.length&&(0!=a(".fp-section.active").index(".fp-section")||0==a(".fp-section.active").index(".fp-section")&&0!=b.index())&&I(b);c.fixedElements&&c.css3&&a(c.fixedElements).appendTo("body");
c.navigation&&(k.css("margin-top","-"+k.height()/2+"px"),k.find("li").eq(a(".fp-section.active").index(".fp-section")).find("a").addClass("active"));c.menu&&c.css3&&a(c.menu).closest(".fullpage-wrapper").length&&a(c.menu).appendTo("body");c.scrollOverflow?("complete"===document.readyState&&M(),a(window).on("load",M)):a.isFunction(c.afterRender)&&c.afterRender.call(this);b=window.location.hash.replace("#","").split("/")[0];if(b.length){var e=a('[data-anchor="'+b+'"]');!c.animateAnchor&&e.length&&(c.autoScrolling?
u(e.position().top):(u(0),a("html, body").scrollTop(e.position().top)),G(b),H(b,null),a.isFunction(c.afterLoad)&&c.afterLoad.call(this,b,e.index(".fp-section")+1),e.addClass("active").siblings().removeClass("active"))}a(window).on("load",function(){var a=window.location.hash.replace("#","").split("/"),b=a[0],a=a[1];b&&K(b,a)})});a("html, body").bind("scroll mousedown DOMMouseScroll mousewheel keyup",function(){!c.autoScrolling&&c.fitSection&&(a("html, body").stop(),q=!1)});var O,P,E=!1;a(window).on("scroll",
N);var r=0,D=0,p=0,C=0;a(window).on("hashchange",Y);a(document).keydown(function(b){if(c.keyboardScrolling&&!q)switch(b.which){case 38:case 33:a.fn.fullpage.moveSectionUp();break;case 40:case 34:a.fn.fullpage.moveSectionDown();break;case 36:a.fn.fullpage.moveTo(1);break;case 35:a.fn.fullpage.moveTo(a(".fp-section").length);break;case 37:a.fn.fullpage.moveSlideLeft();break;case 39:a.fn.fullpage.moveSlideRight()}});a(document).on("click touchstart","#fp-nav a",function(b){b.preventDefault();b=a(this).parent().index();
n(a(".fp-section").eq(b))});a(document).on("click touchstart",".fp-slidesNav a",function(b){b.preventDefault();b=a(this).closest(".fp-section").find(".fp-slides");var c=b.find(".fp-slide").eq(a(this).closest("li").index());x(b,c)});a(document).on({mouseenter:function(){var b=a(this).data("tooltip");a('<div class="fp-tooltip '+c.navigationPosition+'">'+b+"</div>").hide().appendTo(a(this)).fadeIn(200)},mouseleave:function(){a(this).find(".fp-tooltip").fadeOut(200,function(){a(this).remove()})}},"#fp-nav li");
c.normalScrollElements&&(a(document).on("mouseenter",c.normalScrollElements,function(){a.fn.fullpage.setMouseWheelScrolling(!1)}),a(document).on("mouseleave",c.normalScrollElements,function(){a.fn.fullpage.setMouseWheelScrolling(!0)}));a(".fp-section").on("click touchstart",".fp-controlArrow",function(){a(this).hasClass("fp-prev")?a.fn.fullpage.moveSlideLeft():a.fn.fullpage.moveSlideRight()});a(window).resize($);var aa;a.fn.fullpage.destroy=function(b){a.fn.fullpage.setAutoScrolling(!1);a.fn.fullpage.setAllowScrolling(!1);
a.fn.fullpage.setKeyboardScrolling(!1);a(window).off("scroll",N).off("hashchange",Y).off("resize",$);a(document).off("click","#fp-nav a").off("mouseenter","#fp-nav li").off("mouseleave","#fp-nav li").off("click",".fp-slidesNav a").off("mouseover",c.normalScrollElements).off("mouseout",c.normalScrollElements);a(".fp-section").off("click",".fp-controlArrow");b&&oa()}}})(jQuery);