diff --git a/assets/js/winter.js b/assets/js/winter.js new file mode 100644 index 0000000..03b19c9 --- /dev/null +++ b/assets/js/winter.js @@ -0,0 +1,136 @@ +/* + Strata by HTML5 UP + html5up.net | @ajlkn + Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) +*/ + +(function($) { + + var $window = $(window), + $body = $('body'), + $header = $('#header'), + $footer = $('#footer'), + $main = $('#main'), + settings = { + + // Parallax background effect? + parallax: true, + + // Parallax factor (lower = more intense, higher = less intense). + parallaxFactor: 20 + + }; + + // Breakpoints. + breakpoints({ + xlarge: [ '1281px', '1800px' ], + large: [ '981px', '1280px' ], + medium: [ '737px', '980px' ], + small: [ '481px', '736px' ], + xsmall: [ null, '480px' ], + }); + + // Play initial animations on page load. + $window.on('load', function() { + window.setTimeout(function() { + $body.removeClass('is-preload'); + }, 100); + }); + + // Touch? + if (browser.mobile) { + + // Turn on touch mode. + $body.addClass('is-touch'); + + // Height fix (mostly for iOS). + window.setTimeout(function() { + $window.scrollTop($window.scrollTop() + 1); + }, 0); + + } + + // Footer. + breakpoints.on('<=medium', function() { + $footer.insertAfter($main); + }); + + breakpoints.on('>medium', function() { + $footer.appendTo($header); + }); + + // Header. + + // Parallax background. + + // Disable parallax on IE (smooth scrolling is jerky), and on mobile platforms (= better performance). + if (browser.name == 'ie' + || browser.mobile) + settings.parallax = false; + + if (settings.parallax) { + + breakpoints.on('<=medium', function() { + + $window.off('scroll.strata_parallax'); + $header.css('background-position', ''); + + }); + + breakpoints.on('>medium', function() { + + $header.css('background-position', 'left 0px'); + + $window.on('scroll.strata_parallax', function() { + $header.css('background-position', 'left ' + (-1 * (parseInt($window.scrollTop()) / settings.parallaxFactor)) + 'px'); + }); + + }); + + $window.on('load', function() { + $window.triggerHandler('scroll'); + }); + + } + + // Main Sections: Two. + + // Lightbox gallery. + $window.on('load', function() { + + $('#two').poptrox({ + caption: function($a) { return $a.next('h3').text(); }, + overlayColor: '#2c2c2c', + overlayOpacity: 0.85, + popupCloserText: '', + popupLoaderText: '', + selector: '.work-item a.image', + usePopupCaption: true, + usePopupDefaultStyling: false, + usePopupEasyClose: false, + usePopupNav: true, + windowMargin: (breakpoints.active('<=small') ? 0 : 50) + }); + + }); + + var snowStorm=function(g,f){function k(a,d){isNaN(d)&&(d=0);return Math.random()*a+d}function x(){g.setTimeout(function(){a.start(!0)},20);a.events.remove(m?f:g,"mousemove",x)}function y(){(!a.excludeMobile||!D)&&x();a.events.remove(g,"load",y)}this.excludeMobile=this.autoStart=!0;this.flakesMax=128;this.flakesMaxActive=64;this.animationInterval=33;this.useGPU=!0;this.className=null;this.excludeMobile=!0;this.flakeBottom=null;this.followMouse=!0;this.snowColor="#fff";this.snowCharacter="•";this.snowStick= + !0;this.targetElement=null;this.useMeltEffect=!0;this.usePixelPosition=this.usePositionFixed=this.useTwinkleEffect=!1;this.freezeOnBlur=!0;this.flakeRightOffset=this.flakeLeftOffset=0;this.flakeHeight=this.flakeWidth=8;this.vMaxX=5;this.vMaxY=4;this.zIndex=0;var a=this,q,m=navigator.userAgent.match(/msie/i),E=navigator.userAgent.match(/msie 6/i),D=navigator.userAgent.match(/mobile|opera m(ob|in)/i),r=m&&"BackCompat"===f.compatMode||E,h=null,n=null,l=null,p=null,s=null,z=null,A=null,v=1,t=!1,w=!1, + u;a:{try{f.createElement("div").style.opacity="0.5"}catch(F){u=!1;break a}u=!0}var B=!1,C=f.createDocumentFragment();q=function(){function c(b){g.setTimeout(b,1E3/(a.animationInterval||20))}function d(a){return void 0!==h.style[a]?a:null}var e,b=g.requestAnimationFrame||g.webkitRequestAnimationFrame||g.mozRequestAnimationFrame||g.oRequestAnimationFrame||g.msRequestAnimationFrame||c;e=b?function(){return b.apply(g,arguments)}:null;var h;h=f.createElement("div");e={transform:{ie:d("-ms-transform"), + moz:d("MozTransform"),opera:d("OTransform"),webkit:d("webkitTransform"),w3:d("transform"),prop:null},getAnimationFrame:e};e.transform.prop=e.transform.w3||e.transform.moz||e.transform.webkit||e.transform.ie||e.transform.opera;h=null;return e}();this.timer=null;this.flakes=[];this.active=this.disabled=!1;this.meltFrameCount=20;this.meltFrames=[];this.setXY=function(c,d,e){if(!c)return!1;a.usePixelPosition||w?(c.style.left=d-a.flakeWidth+"px",c.style.top=e-a.flakeHeight+"px"):r?(c.style.right=100-100* + (d/h)+"%",c.style.top=Math.min(e,s-a.flakeHeight)+"px"):a.flakeBottom?(c.style.right=100-100*(d/h)+"%",c.style.top=Math.min(e,s-a.flakeHeight)+"px"):(c.style.right=100-100*(d/h)+"%",c.style.bottom=100-100*(e/l)+"%")};this.events=function(){function a(c){c=b.call(c);var d=c.length;e?(c[1]="on"+c[1],3b.vX?b.vX=0.2:0>b.vX&&-0.2b.vY&&(b.vY=0.2)};this.move=function(){var c=b.vX*v;b.x+=c;b.y+=b.vY*b.vAmp;b.x>=h||h-b.xc&&b.x-a.flakeLeftOffset<-a.flakeWidth&&(b.x=h-a.flakeWidth-1);b.refresh();l+p-b.y+a.flakeHeight + b.type&&!b.melting&&0.998b.twinkleFrame?0.97a.flakesMaxActive)a.flakes[a.flakes.length-1].active=-1;a.targetElement.appendChild(C)};this.timerInit=function(){a.timer= + !0;a.snow()};this.init=function(){var c;for(c=0;c