-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquickQuery.min.js
1 lines (1 loc) · 2.78 KB
/
quickQuery.min.js
1
function scrollToTop(o,s,n){0!=n&&$(o).css("cursor","pointer"),$(o).on("click",function(){$("html, body").animate({scrollTop:0},s)})}function scrollTo(o,s,n,t,e){var i=$(s),a=0;t&&(a=t),0!=e&&$(o).css("cursor","pointer"),$(o).on("click",function(){$("html, body").animate({scrollTop:i.offset().top+a},n)})}function appear(o,s,n){var t=1;n&&(t=n),$(o).css("opacity","0"),$(o).fadeTo(s,t)}function timedAppear(o,s,n,t){$(o).css("opacity","0"),setTimeout(function(){appear(o,s,n)},t)}function lazyAppear(o,s,n){var t=0;$(o).css("opacity","0"),$(window).scroll(function(){if(0==t){var e=$(o).offset().top+$(o).outerHeight();$(this).scrollTop()+$(this).height()>e&&(appear(o,s,n),t=1)}return!1})}function ghostHeader(o){$(window).scroll(function(){var s=$(this).scrollTop(),n=$(o).offset().top+$(o).outerHeight(),t=1-s/n;$(o).css("opacity",t)})}function ghostFooter(o){$(window).scroll(function(){var s=$(this).height()+$(this).scrollTop(),n=$(o).offset().top,t=$(o).offset().top+$(o).outerHeight(),e=(s-n)/(t-n);$(o).css("opacity",e)})}function cssHover(o,s,n,t,e,i){i&&("fast"==i?i=200:"normal"==i?i=400:"slow"==i&&(i=600),$(s).css({transition:n+" "+i+"ms ease-in-out",WebkitTransition:n+" "+i+"ms ease-in-out",MozTransition:n+" "+i+"ms ease-in-out",MsTransition:n+" "+i+"ms ease-in-out",OTransition:n+" "+i+"ms ease-in-out"})),$(o).hover(function(){$(s).css(n,t)},function(){$(s).css(n,e)})}function isMobile(){return!!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function backgroundImg(o){var s=new Image;s.src=o,s.onload=function(){$("body").css({background:"url("+o+")no-repeat 50% 50% fixed","background-size":"cover"})}}function hoverShadow(o,s,n,t){shadowOne=shadowTwo=10,shadowThree=5,shadowColor="#888",shadowTransition=500,n&&(shadowOne*=n,shadowTwo*=n,shadowThree*=n),t&&(shadowColor=t),(s||0==s)&&(shadowTransition=s),shadowString=shadowOne+"px "+shadowTwo+"px "+shadowThree+"px ",cssHover(o,o,"box-shadow",shadowString+" "+shadowColor,"",shadowTransition)}function hoverOpacity(o,s,n,t){mouseIn=1,mouseOut=.7,opacTransition=0,s&&(mouseIn=s),n&&(mouseOut=n),(t||0==t)&&(opacTransition=t),cssHover(o,o,"opacity",mouseOut,mouseIn,opacTransition)}function hoverScale(o,s,n){scaleSize=1.2,scaleTransition=500,s&&(scaleSize=s),(n||0==n)&&(scaleTransition=n),cssArgOne="scale("+scaleSize+")",cssArgTwo="scale(1)",cssHover(o,o,"transform",cssArgOne,cssArgTwo,scaleTransition)}function cycleText(o,s,n){var t=1e3;(n||0==n)&&(t=n);var e=-1;setInterval(function(){e++,e>=s.length&&(e=0),$(o).html(s[e])},t)}function cyclePic(o,s,n,t){var e=5e3,i=1e3;(n||0==n)&&(e=n),(t||0==t)&&(i=t);var a=[];s.forEach(function(o){property="url("+o+")no-repeat 50% 50%",a.push(property)});var r=-1;setInterval(function(){r++,r>=s.length&&(r=0),$(o).fadeOut(i,function(){$(this).css("background",a[r])}),$(o).fadeIn(i)},e)}