1(function($){ 2 $.fn.UItoTop = function(options) { 3 4 var defaults = { 5 text: '', 6 min: 200, 7 scrollSpeed: 800, 8 containerID: 'toTop', 9 containerHoverID: 'toTopHover', 10 easingType: 'linear', 11 min_width:parseInt($('body').css("min-width"),10), 12 main_width:parseInt($('body').css("min-width"),10)/2 13 14 }; 15 16 var settings = $.extend(defaults, options); 17 var containerIDhash = '#' + settings.containerID; 18 var containerHoverIDHash = '#'+settings.containerHoverID; 19 20 $('body').append('<a href="#" id="'+settings.containerID+'">'+settings.text+'</a>'); 21 22 var button_width = parseInt($(containerIDhash).css("width"))+90 23 var button_width_1 = parseInt($(containerIDhash).css("width"))+20 24 var max_width = defaults.min_width+button_width; 25 var margin_right_1 = -(defaults.main_width+button_width_1) 26 var margin_right_2 = -(defaults.main_width-20) 27 28 function top(){ 29 if(($(window).width()<=max_width)&&($(window).width()>=defaults.min_width))$(containerIDhash).stop().animate({marginRight:margin_right_2,right:'50%'}) 30 else if($(window).width()<=defaults.min_width)$(containerIDhash).stop().css({marginRight:0,right:10}) 31 else $(containerIDhash).stop().animate({marginRight:margin_right_1,right:'50%'}) 32 } 33 top() 34 $(containerIDhash).hide().click(function(){ 35 $('html, body').stop().animate({scrollTop:0}, settings.scrollSpeed, settings.easingType); 36 $('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType); 37 return false; 38 }) 39 40 .prepend('<span id="'+settings.containerHoverID+'"></span>') 41 .hover(function() { 42 $(containerHoverIDHash, this).stop().animate({ 43 'opacity': 1 44 }, 600, 'linear'); 45 }, function() { 46 $(containerHoverIDHash, this).stop().animate({ 47 'opacity': 0 48 }, 700, 'linear'); 49 }); 50 51 $(window).scroll(function() { 52 var sd = $(window).scrollTop(); 53 if(typeof document.body.style.maxHeight === "undefined") { 54 $(containerIDhash).css({ 55 'position': 'absolute', 56 'top': $(window).scrollTop() + $(window).height() - 50 57 }); 58 } 59 if ( sd > settings.min ) 60 $(containerIDhash).css({display: 'block'}); 61 else 62 $(containerIDhash).css({display: 'none'}); 63 }); 64 $(window).resize(function(){top()}) 65}; 66})(jQuery); 67 68$(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.