/** * Copyright (c) 2007 Ariel Flesler - afleslergmailcom | https://github.com/flesler * Licensed under MIT * @author Ariel Flesler * @version 2.0.0 */ !function (e) { "function" == typeof define && define.amd ? define(["jquery"], e) : e(jQuery) }(function (e) { function t(t, o, n) { var i = o.hash.slice(1), a = document.getElementById(i) || document.getElementsByName(i)[0]; if (a) { t && t.preventDefault(); var l = e(n.target); if (!(n.lock && l.is(":animated") || n.onBefore && !1 === n.onBefore(t, a, l))) { if (n.stop && l.stop(!0), n.hash) { var r = a.id === i ? "id" : "name", s = e(" ").attr(r, i).css({ position: "absolute", top: e(window).scrollTop(), left: e(window).scrollLeft() }); a[r] = "", e("body").prepend(s), location.hash = o.hash, s.remove(), a[r] = i } l.scrollTo(a, n).trigger("notify.serialScroll", [a]) } } } var o = location.href.replace(/#.*/, ""), n = e.localScroll = function (t) { e("body").localScroll(t) }; return n.defaults = { duration: 1e3, axis: "y", event: "click", stop: !0, target: window, autoscroll: !0 }, e.fn.localScroll = function (i) { function a() { return !!this.href && !!this.hash && this.href.replace(this.hash, "") === o && (!i.filter || e(this).is(i.filter)) } return (i = e.extend({}, n.defaults, i)).autoscroll && i.hash && location.hash && (i.target && window.scrollTo(0, 0), t(0, location, i)), i.lazy ? this.on(i.event, "a,area", function (e) { a.call(this) && t(e, this, i) }) : this.find("a,area").filter(a).bind(i.event, function (e) { t(e, this, i) }).end().end() }, n.hash = function () { }, n });