Update jquery.goup.min.js by request of est31
parent
b8e5a9a79f
commit
cdd40f9aec
|
@ -1,10 +1 @@
|
|||
/*
|
||||
*
|
||||
* Copyright (c) 2014 Daniele Lenares (https://github.com/Ryuk87)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Version 1.0.0
|
||||
*
|
||||
*/
|
||||
(function(e){function t(e,t,n){if(t=="show"){switch(n){case"fade":e.fadeIn();break;case"slide":e.slideDown();break;default:e.fadeIn()}}else{switch(n){case"fade":e.fadeOut();break;case"slide":e.slideUp();break;default:e.fadeOut()}}}e.goup=function(n){var r=e.extend({location:"right",locationOffset:20,bottomOffset:10,containerSize:40,containerRadius:10,containerClass:"goup-container",arrowClass:"goup-arrow",alwaysVisible:false,trigger:500,entryAnimation:"fade",goupSpeed:"slow",hideUnderWidth:500,containerColor:"#000",arrowColor:"#fff",title:"",titleAsText:false,titleAsTextClass:"goup-text"},n);e("body").append('<div style="display:none" class="'+r.containerClass+'"></div>');var i=e("."+r.containerClass);e(i).html('<div class="'+r.arrowClass+'"></div>');var s=e("."+r.arrowClass);if(r.location!="right"&&r.location!="left"){r.location="right"}if(r.locationOffset<0){r.locationOffset=0}if(r.bottomOffset<0){r.bottomOffset=0}if(r.containerSize<20){r.containerSize=20}if(r.containerRadius<0){r.containerRadius=0}if(r.trigger<0){r.trigger=0}if(r.hideUnderWidth<0){r.hideUnderWidth=0}var o=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;if(!o.test(r.containerColor)){r.containerColor="#000"}if(!o.test(r.arrowColor)){r.arrowColor="#fff"}if(r.title===""){r.titleAsText=false}var u={};u={position:"fixed",width:r.containerSize,height:r.containerSize,background:r.containerColor,cursor:"pointer"};u["bottom"]=r.bottomOffset;u[r.location]=r.locationOffset;u["border-radius"]=r.containerRadius;e(i).css(u);if(!r.titleAsText){e(i).attr("title",r.title)}else{e("body").append('<div class="'+r.titleAsTextClass+'">'+r.title+"</div>");var a=e("."+r.titleAsTextClass);e(a).attr("style",e(i).attr("style"));e(a).css("background","transparent").css("width",r.containerSize+40).css("height","auto").css("text-align","center").css(r.location,r.locationOffset-20);var f=e(a).height()+10;e(i).css("bottom","+="+f+"px")}var l={};var c=.25*r.containerSize;l={width:0,height:0,margin:"0 auto","padding-top":Math.ceil(.325*r.containerSize),"border-style":"solid","border-width":"0 "+c+"px "+c+"px "+c+"px","border-color":"transparent transparent "+r.arrowColor+" transparent"};e(s).css(l);var h=false;e(window).resize(function(){if(e(window).outerWidth()<=r.hideUnderWidth){h=true;t(e(i),"hide",r.entryAnimation);if(a)t(e(a),"hide",r.entryAnimation)}else{h=false;e(window).trigger("scroll")}});if(e(window).outerWidth()<=r.hideUnderWidth){h=true;e(i).hide();if(a)e(a).hide()}if(!r.alwaysVisible){e(window).scroll(function(){if(e(window).scrollTop()>=r.trigger&&!h){t(e(i),"show",r.entryAnimation);if(a)t(e(a),"show",r.entryAnimation)}if(e(window).scrollTop()<r.trigger&&!h){t(e(i),"hide",r.entryAnimation);if(a)t(e(a),"hide",r.entryAnimation)}})}else{t(e(i),"show",r.entryAnimation);if(a)t(e(a),"show",r.entryAnimation)}if(e(window).scrollTop()>=r.trigger&&!h){t(e(i),"show",r.entryAnimation);if(a)t(e(a),"show",r.entryAnimation)}var p=true;e(i).add(a).on("click",function(){if(p){p=false;e("html,body").animate({scrollTop:0},r.goupSpeed,function(){p=true})}return false})}})(jQuery)
|
||||
!function(a){function b(a,b,c){if("show"==b)switch(c){case"fade":a.fadeIn();break;case"slide":a.slideDown();break;default:a.fadeIn()}else switch(c){case"fade":a.fadeOut();break;case"slide":a.slideUp();break;default:a.fadeOut()}}a.goup=function(c){var d=a.extend({location:"right",locationOffset:20,bottomOffset:10,containerSize:44,containerRadius:10,containerClass:"goup-container",arrowClass:"goup-arrow",alwaysVisible:!1,trigger:500,entryAnimation:"fade",goupSpeed:"slow",hideUnderWidth:500,containerColor:"#000",arrowColor:"#fff",title:"",titleAsText:!1,titleAsTextClass:"goup-text"},c);a("body").append('<div style="display:none" class="'+d.containerClass+'"></div>');var e=a("."+d.containerClass);a(e).html('<div class="'+d.arrowClass+'"></div>');var f=a("."+d.arrowClass);"right"!=d.location&&"left"!=d.location&&(d.location="right"),d.locationOffset<0&&(d.locationOffset=0),d.bottomOffset<0&&(d.bottomOffset=0),d.containerSize<20&&(d.containerSize=20),d.containerRadius<0&&(d.containerRadius=0),d.trigger<0&&(d.trigger=0),d.hideUnderWidth<0&&(d.hideUnderWidth=0);var g=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i;g.test(d.containerColor)||(d.containerColor="#000"),g.test(d.arrowColor)||(d.arrowColor="#fff"),""===d.title&&(d.titleAsText=!1);var h={};if(h={position:"fixed",width:d.containerSize,height:d.containerSize,background:d.containerColor,cursor:"pointer"},h.bottom=d.bottomOffset,h[d.location]=d.locationOffset,h["border-radius"]=d.containerRadius,a(e).css(h),d.titleAsText){a("body").append('<div class="'+d.titleAsTextClass+'">'+d.title+"</div>");var i=a("."+d.titleAsTextClass);a(i).attr("style",a(e).attr("style")),a(i).css("background","transparent").css("width",d.containerSize+40).css("height","auto").css("text-align","center").css(d.location,d.locationOffset-20);var j=a(i).height()+10;a(e).css("bottom","+="+j+"px")}else a(e).attr("title",d.title);var k={},l=.25*d.containerSize;k={width:0,height:0,margin:"0 auto","padding-top":Math.ceil(.325*d.containerSize),"border-style":"solid","border-width":"0 "+l+"px "+l+"px "+l+"px","border-color":"transparent transparent "+d.arrowColor+" transparent"},a(f).css(k);var m=!1;a(window).resize(function(){a(window).outerWidth()<=d.hideUnderWidth?(m=!0,b(a(e),"hide",d.entryAnimation),i&&b(a(i),"hide",d.entryAnimation)):(m=!1,a(window).trigger("scroll"))}),a(window).outerWidth()<=d.hideUnderWidth&&(m=!0,a(e).hide(),i&&a(i).hide()),d.alwaysVisible?(b(a(e),"show",d.entryAnimation),i&&b(a(i),"show",d.entryAnimation)):a(window).scroll(function(){a(window).scrollTop()>=d.trigger&&!m&&(b(a(e),"show",d.entryAnimation),i&&b(a(i),"show",d.entryAnimation)),a(window).scrollTop()<d.trigger&&!m&&(b(a(e),"hide",d.entryAnimation),i&&b(a(i),"hide",d.entryAnimation))}),a(window).scrollTop()>=d.trigger&&!m&&(b(a(e),"show",d.entryAnimation),i&&b(a(i),"show",d.entryAnimation));var n=!0;a(e).add(i).on("click",function(){return n&&(n=!1,a("html,body").animate({scrollTop:0},d.goupSpeed,function(){n=!0})),!1})}}(jQuery);
|
Loading…
Reference in New Issue