diff --git a/js/jquery.ui.totop.js b/js/jquery.ui.totop.js index c2e9911..d7dba53 100755 --- a/js/jquery.ui.totop.js +++ b/js/jquery.ui.totop.js @@ -1,6 +1,6 @@ /* |-------------------------------------------------------------------------- -| UItoTop jQuery Plugin 1.2 by Matt Varone +| UItoTop jQuery Plugin 1.2.1 by Matt Varone - Modified: Justin Obney | http://www.mattvarone.com/web-design/uitotop-jquery-plugin/ |-------------------------------------------------------------------------- */ @@ -15,16 +15,17 @@ containerID: 'toTop', containerHoverID: 'toTopHover', scrollSpeed: 1200, - easingType: 'linear' + easingType: 'linear', + opacity: 1 }, settings = $.extend(defaults, options), containerIDhash = '#' + settings.containerID, containerHoverIDHash = '#'+settings.containerHoverID; - + $('body').append(''+settings.text+''); $(containerIDhash).hide().on('click.UItoTop',function(){ $('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType); - $('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType); + $(containerHoverIDHash, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType); return false; }) .prepend('') @@ -32,12 +33,12 @@ $(containerHoverIDHash, this).stop().animate({ 'opacity': 1 }, 600, 'linear'); - }, function() { + }, function() { $(containerHoverIDHash, this).stop().animate({ 'opacity': 0 }, 700, 'linear'); }); - + $(window).scroll(function() { var sd = $(window).scrollTop(); if(typeof document.body.style.maxHeight === "undefined") { @@ -46,10 +47,10 @@ 'top': sd + $(window).height() - 50 }); } - if ( sd > settings.min ) - $(containerIDhash).fadeIn(settings.inDelay); - else - $(containerIDhash).fadeOut(settings.Outdelay); + if ( sd > settings.min ) + $(containerIDhash).stop().fadeTo(settings.inDelay, settings.opacity); + else + $(containerIDhash).stop().fadeTo(settings.Outdelay, 0); }); }; })(jQuery); \ No newline at end of file diff --git a/js/jquery.ui.totop.min.js b/js/jquery.ui.totop.min.js index 83f845a..c757a78 100755 --- a/js/jquery.ui.totop.min.js +++ b/js/jquery.ui.totop.min.js @@ -1,5 +1,2 @@ -/* UItoTop jQuery Plugin 1.2 | Matt Varone | http://www.mattvarone.com/web-design/uitotop-jquery-plugin */ -(function($){$.fn.UItoTop=function(options){var defaults={text:'To Top',min:200,inDelay:600,outDelay:400,containerID:'toTop',containerHoverID:'toTopHover',scrollSpeed:1200,easingType:'linear'},settings=$.extend(defaults,options),containerIDhash='#'+settings.containerID,containerHoverIDHash='#'+settings.containerHoverID;$('body').append(''+settings.text+'');$(containerIDhash).hide().on('click.UItoTop',function(){$('html, body').animate({scrollTop:0},settings.scrollSpeed,settings.easingType);$('#'+settings.containerHoverID,this).stop().animate({'opacity':0},settings.inDelay,settings.easingType);return false;}).prepend('').hover(function(){$(containerHoverIDHash,this).stop().animate({'opacity':1},600,'linear');},function(){$(containerHoverIDHash,this).stop().animate({'opacity':0},700,'linear');});$(window).scroll(function(){var sd=$(window).scrollTop();if(typeof document.body.style.maxHeight==="undefined"){$(containerIDhash).css({'position':'absolute','top':sd+$(window).height()-50});} -if(sd>settings.min) -$(containerIDhash).fadeIn(settings.inDelay);else -$(containerIDhash).fadeOut(settings.Outdelay);});};})(jQuery); \ No newline at end of file +/* UItoTop jQuery Plugin 1.2 | Matt Varone | Modified: Justin Obney | http://www.mattvarone.com/web-design/uitotop-jquery-plugin */ +(function(e){e.fn.UItoTop=function(t){var n={text:"To Top",min:200,inDelay:600,outDelay:400,containerID:"toTop",containerHoverID:"toTopHover",scrollSpeed:1200,easingType:"linear",opacity:1},r=e.extend(n,t),i="#"+r.containerID,s="#"+r.containerHoverID;e("body").append(''+r.text+"");e(i).hide().on("click.UItoTop",function(){e("html, body").animate({scrollTop:0},r.scrollSpeed,r.easingType);e(s,this).stop().animate({opacity:0},r.inDelay,r.easingType);return false}).prepend('').hover(function(){e(s,this).stop().animate({opacity:1},600,"linear")},function(){e(s,this).stop().animate({opacity:0},700,"linear")});e(window).scroll(function(){var t=e(window).scrollTop();if(typeof document.body.style.maxHeight==="undefined"){e(i).css({position:"absolute",top:t+e(window).height()-50})}if(t>r.min)e(i).stop().fadeTo(r.inDelay,r.opacity);else e(i).stop().fadeTo(r.Outdelay,0)})}})(jQuery) \ No newline at end of file