(function(b) {
b.fn.pagepiling = function(c) {
function s() {
var a = destination.index(".pp-section");
return b(".pp-section.active").index(".pp-section") < a ? "down" : "up"
}
function g(a, d) {
var p = b(".pp-section.active"),
f = a.data("anchor"),
e = a.index(".pp-section"),
g = s(a),
h = p.index(".pp-section") + 1;
"undefined" === typeof d && (d = !0);
"undefined" !== typeof f && c.anchors.length && (location.hash = f);
a.addclass("active").siblings().removeclass("active");
if (p.index(".pp-section") < e) {
var k = "translate3d(0px, -100%, 0px)",
n = "-100%",
q = b(".pp-section").map(function(d) {
if (d < a.index(".pp-section")) return b(this)
});
c.css3 || q.each(function(a) {
a != p.index(".pp-section") && b(this).css({
top: n
})
});
var r = p,
l = function() {}
} else k = "translate3d(0px, 0px, 0px)", n = "0", q = b(".pp-section").map(function(d) {
if (d > a.index(".pp-section")) return b(this)
}), r = a, l = function() {
q.each(function(a) {
b(this).css({
top: n
})
})
};
var m = function() {
b.isfunction(c.afterload) && c.afterload.call(this, f, e + 1)
};
b.isfunction(c.onleave) && c.onleave.call(this, h, e + 1, g);
c.css3 ? (t(r, k, d), q.each(function() {
t(b(this), k, d)
}), settimeout(function() {
m()
}, c.scrollingspeed)) : d ? r.animate({
top: n
}, c.scrollingspeed, c.easing, function() {
l();
m()
}) : (r.css("top", n), settimeout(function() {
l();
m()
}, 400));
b(f);
c(f, e);
u = f;
v = (new date).gettime()
}
function l() {
return (new date).gettime() - v < 600 + c.scrollingspeed ? !0 : !1
}
function t(a, b, c) {
a.toggleclass("pp-easing", c);
a.css({
"-webkit-transform": b,
"-moz-transform": b,
"-ms-transform": b,
transform: b
})
}
function h(a) {
if (!l()) {
a = window.event || a;
a = math.max(-1, math.min(1, a.wheeldelta || -a.deltay || -a.detail));
var d = b(".pp-section.active"),
d = w(d);
0 > a ? k("down", d) : k("up", d);
return !1
}
}
function k(a, d) {
if ("down" == a) var c = "bottom",
e = b.fn.pagepiling.movesectiondown;
else c = "top", e = b.fn.pagepiling.movesectionup;
if (0 < d.length) if (isscrolled(c, d)) e();
else return !0;
else e()
}
function w(a) {
return scrollable = a.find(".pp-scrollable")
}
function s(a) {
var c = b(".pp-section.active").index(".pp-section");
a = a.index(".pp-section");
return c > a ? "up" : "down"
}
function x() {
return window.pointerevent ? {
down: "pointerdown",
move: "pointermove",
up: "pointerup"
} : {
down: "mspointerdown",
move: "mspointermove",
up: "mspointerup"
}
}
function y(a) {
var b = [];
window.navigator.mspointerenabled ? (b.y = a.pagey, b.x = a.pagex) : (b.y = a.touches[0].pagey, b.x = a.touches[0].pagex);
return b
}
function d(a) {
touchstarty = y(a.originalevent).y
}
function e(a) {
var d = a.originalevent;
a.preventdefault();
z(a.target) || (a = b(".pp-section.active"), a = w(a), l() || (d = y(d), touchendy = d.y, touchendx = d.x, math.abs(touchstarty - touchendy) > e.height() / 100 * c.touchsensitivity && (touchstarty > touchendy ? k("down", a) : touchendy > touchstarty && k("up", a))))
}
function z(a, d) {
d = d || 0;
var e = b(a).parent();
return d < c.normalscrollelementtouchthreshold && e.is(c.normalscrollelements) ? !0 : d == c.normalscrollelementtouchthreshold ? !1 : z(e, ++d)
}
function f() {
b("body").append('
');
var a = b("#pp-nav");
a.css("color", c.navigation.textcolor);
a.addclass(c.navigation.position);
for (var d = 0; d < b(".pp-section").length; d++) {
var e = "";
c.anchors.length && (e = c.anchors[d]);
if ("undefined" !== typeof c.navigation.tooltips) {
var f = c.navigation.tooltips[d];
"undefined" === typeof f && (f = "")
}
/*data-tooltip="' + f + '"*/
a.find("ul").append(''+f+'')
}
a.find("span").css("border-color", c.navigation.bulletscolor)
}
function c(a, d) {
c.navigation && (b("#pp-nav").find(".active").removeclass("active"), a ? b("#pp-nav").find('a[href="#' + a + '"]').addclass("active") : b("#pp-nav").find("li").eq(d).find("a").addclass("active"))
}
function b(a) {
c.menu && (b(c.menu).find(".active").removeclass("active"), b(c.menu).find('[data-menuanchor="' + a + '"]').addclass("active"))
}
function g() {
var a = document.createelement("p"),
b, c = {
webkittransform: "-webkit-transform",
otransform: "-o-transform",
mstransform: "-ms-transform",
moztransform: "-moz-transform",
transform: "transform"
};
document.body.insertbefore(a, null);
for (var e in c) void 0 !== a.style[e] && (a.style[e] = "translate3d(1px,1px,1px)", b = window.getcomputedstyle(a).getpropertyvalue(c[e]));
document.body.removechild(a);
return void 0 !== b && 0 < b.length && "none" !== b
}
var e = b(this),
u, v = 0,
a = "ontouchstart" in window || 0 < navigator.msmaxtouchpoints;
c = b.extend({
menu: null,
verticalcentered: !0,
sectionscolor: [],
anchors: [],
scrollingspeed: 700,
easing: "swing",
loopbottom: !1,
looptop: !1,
css3: !0,
navigation: {
textcolor: "#000",
bulletscolor: "#000",
position: "right",
tooltips: ["首页", "关于", "产品", "渠道", "客户", "招兵","联系"]
},
normalscrollelementtouchthreshold: 5,
touchsensitivity: 5,
keyboardscrolling: !0,
sectionselector: ".section",
animateanchor: !1,
afterload: null,
onleave: null,
afterrender: null
}, c);
b.fn.pagepiling.setscrollingspeed = function(a) {
c.scrollingspeed = a
};
b.fn.pagepiling.setmousewheelscrolling = function(a) {
a ? e.get(0).addeventlistener ? (e.get(0).addeventlistener("mousewheel", h, !1), e.get(0).addeventlistener("wheel", h, !1)) : e.get(0).attachevent("onmousewheel", h) : e.get(0).addeventlistener ? (e.get(0).removeeventlistener("mousewheel", h, !1), e.get(0).removeeventlistener("wheel", h, !1)) : e.get(0).detachevent("onmousewheel", h)
};
b.fn.pagepiling.setallowscrolling = function(a) {
a ? (b.fn.pagepiling.setmousewheelscrolling(!0), a && (mspointer = x(), e.off("touchstart " + mspointer.down).on("touchstart " + mspointer.down, d), e.off("touchmove " + mspointer.move).on("touchmove " + mspointer.move, e))) : (b.fn.pagepiling.setmousewheelscrolling(!1), a && (mspointer = x(), e.off("touchstart " + mspointer.down), e.off("touchmove " + mspointer.move)))
};
b.fn.pagepiling.setkeyboardscrolling = function(a) {
c.keyboardscrolling = a
};
b.fn.pagepiling.movesectionup = function() {
var a = b(".pp-section.active").prev(".pp-section");
!a.length && c.looptop && (a = b(".pp-section").last());
a.length && g(a)
};
b.fn.pagepiling.movesectiondown = function() {
var a = b(".pp-section.active").next(".pp-section");
!a.length && c.loopbottom && (a = b(".pp-section").first());
a.length && g(a)
};
b.fn.pagepiling.moveto = function(a) {
var c = "",
c = isnan(a) ? b('[data-anchor="' + a + '"]') : b(".pp-section").eq(a - 1);
0 < c.length && g(c)
};
b(c.sectionselector).each(function() {
b(this).addclass("pp-section")
});
c.css3 && (c.css3 = g());
b(e).css({
overflow: "hidden",
"-ms-touch-action": "none",
"touch-action": "none"
});
b.fn.pagepiling.setallowscrolling(!0);
b.isemptyobject(c.navigation) || f();
var m = b(".pp-section").length;
b(".pp-section").each(function(a) {
b(this).data("data-index", a);
b(this).css("z-index", m);
a || 0 !== b(".pp-section.active").length || b(this).addclass("active");
"undefined" !== typeof c.anchors[a] && b(this).attr("data-anchor", c.anchors[a]);
"undefined" !== typeof c.sectionscolor[a] && b(this).css("background-color", c.sectionscolor[a]);
c.verticalcentered && b(this).addclass("pp-table").wrapinner('');
m -= 1
}).promise().done(function() {
c.navigation && ( b("#pp-nav").find("li").eq(b(".pp-section.active").index(".pp-section")).find("a").addclass("active"));
b(window).on("load", function() {
var a = window.location.hash.replace("#", ""),
a = b('.pp-section[data-anchor="' + a + '"]');
0 < a.length && g(a, c.animateanchor)
});
b.isfunction(c.afterrender) && c.afterrender.call(this)
});
b(window).on("hashchange", function() {
var a = window.location.hash.replace("#", "").split("/")[0];
a.length && a && a !== u && (a = isnan(a) ? b('[data-anchor="' + a + '"]') : b(".pp-section").eq(a - 1), g(a))
});
b(document).keydown(function(a) {
if (c.keyboardscrolling && !l()) switch (a.which) {
case 38:
case 33:
b.fn.pagepiling.movesectionup();
break;
case 40:
case 34:
b.fn.pagepiling.movesectiondown();
break;
case 36:
b.fn.pagepiling.moveto(1);
break;
case 35:
b.fn.pagepiling.moveto(b(".pp-section").length);
break;
case 37:
b.fn.pagepiling.moveslideleft();
break;
case 39:
b.fn.pagepiling.moveslideright()
}
});
b(document).on("click touchstart", "#pp-nav a", function(a) {
a.preventdefault();
a = b(this).parent().index();
g(b(".pp-section").eq(a))
});
/*b(document).on({
mouseenter: function() {
var a = b(this).data("tooltip");
b('' + a + "
").hide().appendto(b(this)).fadein(200)
},
mouseleave: function() {
b(this).find(".pp-tooltip").fadeout(200, function() {
b(this).remove()
})
}
}, "#pp-nav li")*/
}
})(jquery);