锘?* scrollup v2.1.1 Author: Mark Goodyear - http://markgoodyear.com Git: https://github.com/markgoodyear/scrollup Copyright 2013 Mark Goodyear. Licensed under the MIT license http://www.opensource.org/licenses/mit-license.php Twitter: @markgdyr */ !function (a, b, c) { a.fn.scrollUp = function (b) { a.data(c.body, "scrollUp") || (a.data(c.body, "scrollUp", !0), a.fn.scrollUp.init(b)) }, a.fn.scrollUp.init = function (d) { var e = a.fn.scrollUp.settings = a.extend({}, a.fn.scrollUp.defaults, d), f = e.scrollTitle ? e.scrollTitle : e.scrollText, g = a("", { id: e.scrollName, href: "#top", title: f }).appendTo("body"); e.scrollImg || g.html(e.scrollText), g.css({ display: "none", position: "fixed", zIndex: e.zIndex }), e.activeOverlay && a("
", { id: e.scrollName + "-active" }).css({ position: "absolute", top: e.scrollDistance + "px", width: "100%", borderTop: "1px dotted" + e.activeOverlay, zIndex: e.zIndex }).appendTo("body"), scrollEvent = a(b).scroll(function () { switch (scrollDis = "top" === e.scrollFrom ? e.scrollDistance : a(c).height() - a(b).height() - e.scrollDistance, e.animation) { case "fade": a(a(b).scrollTop() > scrollDis ? g.fadeIn(e.animationInSpeed) : g.fadeOut(e.animationOutSpeed)); break; case "slide": a(a(b).scrollTop() > scrollDis ? g.slideDown(e.animationInSpeed) : g.slideUp(e.animationOutSpeed)); break; default: a(a(b).scrollTop() > scrollDis ? g.show(0) : g.hide(0)) } }), g.click(function (b) { b.preventDefault(), a("html, body").animate({ scrollTop: 0 }, e.scrollSpeed, e.easingType) }) }, a.fn.scrollUp.defaults = { scrollName: "scrollUp", scrollDistance: 300, scrollFrom: "top", scrollSpeed: 300, easingType: "linear", animation: "fade", animationInSpeed: 200, animationOutSpeed: 200, scrollText: "Scroll to top", scrollTitle: !1, scrollImg: !1, activeOverlay: !1, zIndex: 2147483647 }, a.fn.scrollUp.destroy = function (d) { a.removeData(c.body, "scrollUp"), a("#" + a.fn.scrollUp.settings.scrollName).remove(), a("#" + a.fn.scrollUp.settings.scrollName + "-active").remove(), a.fn.jquery.split(".")[1] >= 7 ? a(b).off("scroll", d) : a(b).unbind("scroll", d) }, a.scrollUp = a.fn.scrollUp } (jQuery, window, document); $(function () { $.scrollUp({ scrollName: 'scrollUp', // Element ID scrollDistance: 100, // Distance from top/bottom before showing element (px) scrollFrom: 'top', // 'top' or 'bottom' scrollSpeed: 300, // Speed back to top (ms) easingType: 'linear', // Scroll to top easing (see http://easings.net/) animation: 'fade', // Fade, slide, none animationInSpeed: 200, // Animation in speed (ms) animationOutSpeed: 200, // Animation out speed (ms) scrollText: '', // Text for element, can contain HTML scrollTitle: '杩斿洖椤堕儴', // Set a custom title if required. Defaults to scrollText scrollImg: true, // Set true to use image activeOverlay: false, // Set CSS color to display scrollUp active point, e.g '#00FFFF' zIndex: 2147483647 // Z-Index for the overlay }); });