/*! * pagepiling.js 1.5.6 * * https://github.com/alvarotrigo/pagePiling.js * @license MIT licensed * * Copyright (C) 2016 alvarotrigo.com - A project by Alvaro Trigo */ ! function(e, n, t, o) { "use strict"; e.fn.pagepiling = function(i) { function a(e) { e.addClass("pp-table").wrapInner('
') } function s(n) { var t = e(".pp-section.active").index(".pp-section"), o = n.index(".pp-section"); return t > o ? "up" : "down" } function c(n, t) { var o = { destination: n, animated: t, activeSection: e(".pp-section.active"), anchorLink: n.data("anchor"), sectionIndex: n.index(".pp-section"), toMove: n, yMovement: s(n), leavingSection: e(".pp-section.active").index(".pp-section") + 1 }; if (!o.activeSection.is(n)) { "undefined" == typeof o.animated && (o.animated = !0), "undefined" != typeof o.anchorLink && v(o.anchorLink, o.sectionIndex), o.destination.addClass("active").siblings().removeClass("active"), o.sectionsToMove = p(o), "down" === o.yMovement ? (o.translate3d = U(), o.scrolling = "-100%", Z.css3 || o.sectionsToMove.each(function(n) { n != o.activeSection.index(".pp-section") && e(this).css(u(o.scrolling)) }), o.animateSection = o.activeSection) : (o.translate3d = "translate3d(0px, 0px, 0px)", o.scrolling = "0", o.animateSection = n), e.isFunction(Z.onLeave) && Z.onLeave.call(this, o.leavingSection, o.sectionIndex + 1, o.yMovement), r(o), A(o.anchorLink), z(o.anchorLink, o.sectionIndex), W = o.anchorLink; var i = (new Date).getTime(); Q = i } } function r(n) { Z.css3 ? (w(n.animateSection, n.translate3d, n.animated), n.sectionsToMove.each(function() { w(e(this), n.translate3d, n.animated) }), setTimeout(function() { l(n) }, Z.scrollingSpeed)) : (n.scrollOptions = u(n.scrolling), n.animated ? n.animateSection.animate(n.scrollOptions, Z.scrollingSpeed, Z.easing, function() { d(n), l(n) }) : (n.animateSection.css(u(n.scrolling)), setTimeout(function() { d(n), l(n) }, 400))) } function l(n) { e.isFunction(Z.afterLoad) && Z.afterLoad.call(this, n.anchorLink, n.sectionIndex + 1) } function p(n) { var t; return t = "down" === n.yMovement ? e(".pp-section").map(function(t) { if (t < n.destination.index(".pp-section")) return e(this) }) : e(".pp-section").map(function(t) { if (t > n.destination.index(".pp-section")) return e(this) }) } function d(n) { "up" === n.yMovement && n.sectionsToMove.each(function(t) { e(this).css(u(n.scrolling)) }) } function u(e) { return "vertical" === Z.direction ? { top: e } : { left: e } } function v(e, n) { Z.anchors.length ? (location.hash = e, f(location.hash)) : f(String(n)) } function f(n) { n = n.replace("#", ""), e("body")[0].className = e("body")[0].className.replace(/\b\s?pp-viewing-[^\s]+\b/g, ""), e("body").addClass("pp-viewing-" + n) } function h() { var o = t.location.hash.replace("#", ""), i = o, a = e(n).find('.pp-section[data-anchor="' + i + '"]'); a.length > 0 && c(a, Z.animateAnchor) } function m() { var e = (new Date).getTime(); return e - Q < J + Z.scrollingSpeed } function g() { var o = t.location.hash.replace("#", "").split("/"), i = o[0]; if (i.length && i && i !== W) { var a; a = isNaN(i) ? e(n).find('[data-anchor="' + i + '"]') : e(".pp-section").eq(i - 1), c(a) } } function S(e) { return { "-webkit-transform": e, "-moz-transform": e, "-ms-transform": e, transform: e } } function w(e, n, t) { e.toggleClass("pp-easing", t), e.css(S(n)) } function b(n) { var o = (new Date).getTime(); n = n || t.event; var i = n.wheelDelta || -n.deltaY || -n.detail, a = Math.max(-1, Math.min(1, i)), s = "undefined" != typeof n.wheelDeltaX || "undefined" != typeof n.deltaX, c = Math.abs(n.wheelDeltaX) < Math.abs(n.wheelDelta) || Math.abs(n.deltaX) < Math.abs(n.deltaY) || !s; G.length > 149 && G.shift(), G.push(Math.abs(i)); var r = o - _; if (_ = o, r > 200 && (G = []), !m()) { var l = e(".pp-section.active"), p = T(l), d = y(G, 10), u = y(G, 70), v = d >= u; return v && c && (a < 0 ? x("down", p) : a > 0 && x("up", p)), !1 } } function y(e, n) { for (var t = 0, o = e.slice(Math.max(e.length - n, 1)), i = 0; i < o.length; i++) t += o[i]; return Math.ceil(t / n) } function x(e, n) { var t, o; if ("down" == e ? (t = "bottom", o = B.moveSectionDown) : (t = "top", o = B.moveSectionUp), n.length > 0) { if (!M(t, n)) return !0; o() } else o() } function M(e, n) { return "top" === e ? !n.scrollTop() : "bottom" === e ? n.scrollTop() + 1 + n.innerHeight() >= n[0].scrollHeight : void 0 } function T(e) { return e.filter(".pp-scrollable") } function C() { F.get(0).addEventListener ? (F.get(0).removeEventListener("mousewheel", b, !1), F.get(0).removeEventListener("wheel", b, !1)) : F.get(0).detachEvent("onmousewheel", b) } function k() { F.get(0).addEventListener ? (F.get(0).addEventListener("mousewheel", b, !1), F.get(0).addEventListener("wheel", b, !1)) : F.get(0).attachEvent("onmousewheel", b) } function E() { if (R) { var e = D(); F.off("touchstart " + e.down).on("touchstart " + e.down, P), F.off("touchmove " + e.move).on("touchmove " + e.move, Y) } } function L() { if (R) { var e = D(); F.off("touchstart " + e.down), F.off("touchmove " + e.move) } } function D() { var e; return e = t.PointerEvent ? { down: "pointerdown", move: "pointermove", up: "pointerup" } : { down: "MSPointerDown", move: "MSPointerMove", up: "MSPointerUp" } } function I(e) { var n = new Array; return n.y = "undefined" != typeof e.pageY && (e.pageY || e.pageX) ? e.pageY : e.touches[0].pageY, n.x = "undefined" != typeof e.pageX && (e.pageY || e.pageX) ? e.pageX : e.touches[0].pageX, n } function X(e) { return "undefined" == typeof e.pointerType || "mouse" != e.pointerType } function P(e) { var n = e.originalEvent; if (X(n)) { var t = I(n); j = t.y, H = t.x } } function Y(n) { var t = n.originalEvent; if (!N(n.target) && X(t)) { var o = e(".pp-section.active"), i = T(o); if (i.length || n.preventDefault(), !m()) { var a = I(t); K = a.y, V = a.x, "horizontal" === Z.direction && Math.abs(H - V) > Math.abs(j - K) ? Math.abs(H - V) > F.width() / 100 * Z.touchSensitivity && (H > V ? x("down", i) : V > H && x("up", i)) : Math.abs(j - K) > F.height() / 100 * Z.touchSensitivity && (j > K ? x("down", i) : K > j && x("up", i)) } } } function N(n, t) { t = t || 0; var o = e(n).parent(); return !!(t < Z.normalScrollElementTouchThreshold && o.is(Z.normalScrollElements)) || t != Z.normalScrollElementTouchThreshold && N(o, ++t) } function q() { e("body .pagepiling").append(' '); var n = e("#pp-nav"); n.css("color", Z.navigation.textColor), n.addClass(Z.navigation.position); for (var t = 0; t < e(".pp-section").length; t++) { var o = ""; if (Z.anchors.length && (o = Z.anchors[t]), "undefined" !== Z.navigation.tooltips) { var i = Z.navigation.tooltips[t]; "undefined" == typeof i && (i = "") } n.find("ul").append('