1(function($){ 2 $.fn.UItoTop = function(options) { 3 4 var defaults = { 5 text: '', 6 min: 500, 7 scrollSpeed: 800, 8 containerID: 'toTop', 9 containerHoverID: 'toTopHover', 10 easingType: 'easeOutCirc', 11 min_width:parseInt($('body').css("min-width"),10), 12 main_width:parseInt($('body').css("min-width"),10)/2 13 }; 14 15 var settings = $.extend(defaults, options); 16 var containerIDhash = '#' + settings.containerID; 17 var containerHoverIDHash = '#'+settings.containerHoverID; 18 19 $('body').append('<a href="#" id="'+settings.containerID+'">'+settings.text+'</a>'); 20 21 var button_width = parseInt($(containerIDhash).css("width"))+90 22 var button_width_1 = parseInt($(containerIDhash).css("width"))+20 23 var max_width = defaults.min_width+button_width; 24 var margin_right_1 = -(defaults.main_width+button_width_1) 25 var margin_right_2 = -(defaults.main_width-20) 26 27 function top(){ 28 if(($(window).width()<=max_width)&&($(window).width()>=defaults.min_width))$(containerIDhash).stop().animate({marginRight:margin_right_2,right:'50%'}) 29 else if($(window).width()<=defaults.min_width)$(containerIDhash).stop().css({marginRight:0,right:10}) 30 else $(containerIDhash).stop().animate({marginRight:margin_right_1,right:'50%'}) 31 } 32 top() 33 $(containerIDhash).hide().click(function(){ 34 $('html, body').stop().animate({scrollTop:0}, settings.scrollSpeed, settings.easingType); 35 $('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType); 36 return false; 37 }) 38 39 .prepend('<span id="'+settings.containerHoverID+'"></span>') 40 .hover(function() { 41 $(containerHoverIDHash, this).stop().animate({ 42 'opacity': 1 43 }, 600, 'linear'); 44 }, function() { 45 $(containerHoverIDHash, this).stop().animate({ 46 'opacity': 0 47 }, 700, 'linear'); 48 }); 49 50 $(window).scroll(function() { 51 var sd = $(window).scrollTop(); 52 if(typeof document.body.style.maxHeight === "undefined") { 53 $(containerIDhash).css({ 54 'position': 'absolute', 55 'top': $(window).scrollTop() + $(window).height() - 50 56 }); 57 } 58 if ( sd > settings.min ) 59 $(containerIDhash).css({display: 'block'}); 60 else 61 $(containerIDhash).css({display: 'none'}); 62 }); 63 $(window).resize(function(){top()}) 64}; 65})(jQuery); 66 67$(window).load(function(){$().UItoTop({easingType: 'easeOutQuart'});})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.