/* scrollup v2.0.0 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=a("",{id:e.scrollname,href:"#top",title:e.scrolltext}).appendto("body");e.scrollimg||f.html(e.scrolltext),f.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?f.fadein(e.animationinspeed):f.fadeout(e.animationoutspeed));break;case"slide":a(a(b).scrolltop()>scrolldis?f.slidedown(e.animationinspeed):f.slideup(e.animationoutspeed));break;default:a(a(b).scrolltop()>scrolldis?f.show(0):f.hide(0))}}),f.click(function(b){b.preventdefault(),a("html, body").animate({scrolltop:0},e.topspeed,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",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); //scrollup配置 $.scrollup({ scrollname: 'scrollup',// element id topdistance: '300', // distance from top before showing element (px) topspeed: 300, // speed back to top (ms) animation: 'fade', // fade, slide, none animationinspeed: 200, // animation in speed (ms) animationoutspeed: 200, // animation out speed (ms) scrolltext: 'scroll to top', // text for element scrollimg: true, activeoverlay: false // set css color to display scrollup active point, e.g '#00ffff' });