You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
996 B
8 lines
996 B
(function(a){a.fn.gotop=function(c){var d=a.extend({content:1170,bottom:30,margin:"none",position:"right",scrollTop:100,duration:700},c);var g=a(window);var f=this;function h(){var i=true;if(d.margin=="none"){if(g.width()<(d.content+(f.width()*2)+4)){i=false}}else{if(g.width()<(d.content+((f.width()+d.right)*2)+4)){i=false}}
|
|
return i}
|
|
function b(){var i=(((g.width()-d.content)/2)-f.width())/2;if(d.position=="left"||d.position=="l"){f.css({left:i+"px"})}else{f.css({right:i+"px"})}}
|
|
function e(){if(g.scrollTop()>d.scrollTop){f.fadeIn()}else{f.fadeOut()}}
|
|
if(!h()){this.hide()}
|
|
if(d.margin=="none"){b()}else{if(d.position=="left"||d.position=="l"){f.css({left:d.margin+"px"})}else{f.css({right:d.margin+"px"})}}
|
|
e();g.resize(function(){if(h()){f.fadeIn()}else{f.fadeOut()}
|
|
if(d.margin=="none"){b()}});g.scroll(function(){e()});return this.css({position:"fixed",right:"10px",cursor:"pointer",bottom:d.bottom+"px"}).click(function(){a("body,html").animate({scrollTop:0},d.duration)})}})(jQuery);
|