pixedelic

fx.js

Apr 2nd, 2015
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. !function(t){"use strict";jQuery.expr[":"].notparents=function(t,e,i){return jQuery(t).parents(i[3]).length<1},function(t){t.fn.extend({actual:function(e,i){if(!this[e])throw'$.actual => The jQuery method "'+e+'" you called does not exist';var a,n,o={absolute:!1,clone:!1,includeMargin:!1},r=t.extend(o,i),s=this.eq(0);if(r.clone===!0)a=function(){var t="position: absolute !important; top: -1000 !important; ";s=s.clone().attr("style",t).appendTo("body")},n=function(){s.remove()};else{var d,l=[],p="";a=function(){d=t.fn.jquery>="1.8.0"?s.parents().addBack().filter(":hidden"):s.parents().andSelf().filter(":hidden"),p+="visibility: hidden !important; display: block !important; ",r.absolute===!0&&(p+="position: absolute !important; "),d.each(function(){var e=t(this);l.push(e.attr("style")),e.attr("style",p)})},n=function(){d.each(function(e){var i=t(this),a=l[e];void 0===a?i.removeAttr("style"):i.attr("style",a)})}}a();var c=/(outer)/g.test(e)?s[e](r.includeMargin):s[e]();return n(),c}})}(jQuery),function(t){function e(t,e){var i=s.scrollTop()-e,a=s.scrollTop()+s.height()+e,n=t.offset().top,o=n+t.outerHeight();return o>=i&&a>=n||a>=o&&n>=i||o>=i&&i>=n}function i(t){r||(r=setTimeout(function(){a(t),r=null},300))}function a(i){t.each(d,function(){e(this.element,this.options.tolerance)?this.invp||(this.invp=!0,this.options.scrolledin&&this.options.scrolledin.call(this.element,i),this.element.trigger("scrolledin",i)):this.invp&&(this.invp=!1,this.options.scrolledout&&this.options.scrolledout.call(this.element,i),this.element.trigger("scrolledout",i))})}function n(t,e){var i={element:t,options:e,invp:!1};return d.push(i),i}function o(t){for(var e=0;e<d.length;e++)if(d[e]===t){d.splice(e,1),t.element=null;break}}var r,s=t(window),d=[];window.addEventListener?window.addEventListener("scroll",i,!1):window.attachEvent&&window.attachEvent("onscroll",i),s.on("resize",i),t(function(){setTimeout(i,0)});var l="pixGridderScrolledIntoView",p={tolerance:null,scrolledin:null,scrolledout:null};t.fn[l]=function(e){var e=t.extend({},p,e);return this.each(function(){var i=t(this),a=t.data(this,l);a?a.options=e:(t.data(this,l,n(i,e)),i.on("remove",t.proxy(function(){t.removeData(this,l),o(a)},this)))}),this}}(jQuery);var e=window.PIXGRIDDER||{};e.rotatingFrames=function(){var e=t(window);t('.row[style*="rotate"]').addClass("pixgridder_rotate").each(function(){if(t(".pix_section_video",this).length)t(this).css({webkitTransform:"rotate(0)",mozTransform:"rotate(0)",msTransform:"rotate(0)",oTransform:"rotate(0)",transform:"rotate(0)"});else if(!t(".rotating-frame",this).length){var i=t(this);i.append('<div class="rotating-frame"><div class="rotating-inside"></div></div>');var a=i.attr("style").match(/rotate\((.+?)deg\)/gi);a=a[0],a=a.replace(/rotate\((.+?)deg\)/gi,"$1");var n,o,r,s,d=-1*a;t(".rotating-frame",i).css({webkitTransform:"rotate("+a+"deg)",mozTransform:"rotate("+a+"deg)",msTransform:"rotate("+a+"deg)",oTransform:"rotate("+a+"deg)",transform:"rotate("+a+"deg)"}),t(".rotating-inside",i).css({webkitTransform:"rotate("+d+"deg)",mozTransform:"rotate("+d+"deg)",msTransform:"rotate("+d+"deg)",oTransform:"rotate("+d+"deg)",transform:"rotate("+d+"deg)"}),"undefined"!=typeof i.attr("style")&&i.attr("style").match(/background-image/)&&(n=i.css("background-image"),i.css("background-image",""),t(".rotating-inside",i).css("background-image",n)),"undefined"!=typeof i.attr("style")&&i.attr("style").match(/background-repeat/)&&(o=i.css("background-repeat"),i.css("background-repeat",""),t(".rotating-inside",i).css("background-repeat",o)),"undefined"!=typeof i.attr("data-pix-ratio")&&(s=i.attr("data-pix-ratio"),i.removeAttr("data-pix-ratio"),t(".rotating-inside",i).attr("data-pix-ratio",s)),"undefined"!=typeof i.attr("style")&&i.attr("style").match(/background-color/)&&(r=i.css("background-color"),i.css("background-color",""),t(".rotating-frame",i).css("background-color",r))}e.trigger("pix-parallax")})},e.pixgridderParallax=function(){var e,i=t(window),a=t("[data-pix-ratio]");a.each(function(){var a=t(this),n=t(".rotating-inside",a).length;a=n?t(".rotating-inside",a):t(this);var o,r,s,d=a.css("background-image"),l="undefined"==typeof a.css("background-size")||"0"==parseFloat(a.css("background-size"))?"100%":a.css("background-size"),p="undefined"==typeof a.css("background-repeat")?"no-repeat":a.css("background-repeat"),c=a.attr("data-pix-ratio"),f=/^url\((['"]?)(.*)\1\)$/.exec(d);f=f?f[2]:"";var u=(t("<img />").one("load",function(){t("img.pix-parallax",a).length||(o='<img src="'+f+'" class="pix-parallax">',r=t(o).naturalWidth(),s=t(o).naturalHeight(),o=t(o).attr("data-orheight",s).attr("data-orwidth",r).attr("src",pixgridder_blank_gif).css({backgroundImage:d,backgroundSize:l,backgroundRepeat:p,position:"absolute"}),a.css({backgroundImage:"",overflow:"hidden"}).prepend(o),i.trigger("pix-parallax"))}).attr("src",f).each(function(){this.complete&&t(this).load()}),function(){e=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;var n=t("img.pix-parallax",a),o=(i.height(),a.offset().top),r=(o+a.outerHeight(),(o-e)*c*-1);"undefined"!=typeof n[0]&&(n[0].style["-webkit-transform"]="translate3d(0,"+r+"px,0)",n[0].style["-moz-transform"]="translate3d(0,"+r+"px,0)",n[0].style["-ms-transform"]="translate3d(0,"+r+"px,0)",n[0].style["-o-transform"]="translate3d(0,"+r+"px,0)",n[0].style.transform="translate3d(0,"+r+"px,0)")}),m=function(){var e=t("img.pix-parallax",a);"undefined"!=typeof e[0]&&(e[0].style["-webkit-transform"]="translate3d(0,0,0)",e[0].style["-moz-transform"]="translate3d(0,0,0)",e[0].style["-ms-transform"]="translate3d(0,0,0)",e[0].style["-o-transform"]="translate3d(0,0,0)",e[0].style.transform="translate3d(0,0,0)")};i.on("pix-parallax resize",function(){!Modernizr.touch&&i.width()>1024&&a.pixGridderScrolledIntoView({tolerance:200,scrolledin:function(){window.addEventListener?(window.addEventListener("load",u,!1),window.addEventListener("popstate",u,!1),window.addEventListener("scroll",u,!1),window.addEventListener("resize",u,!1)):window.attachEvent&&(window.attachEvent("onpopstate",u),window.attachEvent("onscroll",u),window.attachEvent("onresize",u))},scrolledout:function(){window.removeEventListener?(window.removeEventListener("load",u,!1),window.removeEventListener("popstate",u,!1),window.removeEventListener("scroll",u,!1),window.removeEventListener("resize",u,!1)):window.detachEvent&&(window.detachEvent("onpopstate",u),window.detachEvent("onscroll",u),window.detachEvent("onresize",u)),m()}})})}),i.on("pix-parallax resize",function(){t("img.pix-parallax").each(function(){var e,a,n,o,r,s,d=t(this),l=d.parents("div[data-pix-ratio]").eq(0),p=(parseFloat(l.attr("data-pix-ratio")),"absolute"),c=d.parents("div").eq(0),f=c.outerWidth(),u=i.height(),m=c.outerHeight(),x=d.data("orwidth"),g=d.data("orheight"),h=x/g;e=u>m?u:m,s=f/e,h>s?(a=e/g,n=o=r=.5*(f-x*a),d.css({height:e,left:0,"margin-left":o+"px","margin-right":r+"px","margin-top":0,"max-width":"none",position:p,top:0,width:x*a,"z-Index":"-1"})):(a=f/x,n=.5*(e-g*a),d.css({height:g*a,left:0,"margin-left":0,"margin-right":0,"margin-top":n+"px","max-width":"none",position:p,top:0,width:f,"z-Index":"-1"}))})})},e.pixgridderFirstInARow=function(){var e="undefined"!=typeof e?e:".row .column",i=t(window),a=function(){var a=0,n=t(e).filter(":notparents(.pix-letmebe)");n.each(function(){var e,n,o=t(this),r=(i.width(),o.outerWidth());o.removeClass("first-child"),e=o.position(),n=parseFloat(e.left)+10,o.is(":first-child")?(o.attr("data-child","first"),a=0):a>n&&(o.addClass("first-child"),a=0),a+=r})};a(),i.on("resize",function(){a()})},e.initPixElem=function(){var e,i=0,a=0,n=100,o="undefined"!=typeof o?o:".row .column",r=jQuery(".pix-fadeIn, .pix-fadeDown, .pix-fadeUp, .pix-fadeLeft, .pix-fadeRight, .pix-zoomIn, .pix-zoomOut, .pix-rotateIn, .pix-rotateOut, .pix-flipClock, .pix-swing, .pix-turnBackward, .pix-turnForward").add(o);t(r).not(".pix-lazy-load").not(".pix-letmebe").filter(":notparents(.pix-letmebe)").pixGridderScrolledIntoView().on("scrolledin",function(){var o=t(this),r=o.data("delay");o.addClass("pix-lazy-load");var s=o.offset(),d=s.top;o.hasClass("none")||o.hasClass("bx-clone")||("undefined"!=typeof r&&""!==r?a=parseFloat(r):(d!=i?(i=d,e=0):e+=200,a=n+e,o.attr("data-delay",a))),Modernizr.csstransforms3d||(o.filter(".pix-flipClock").removeClass("pix-flipClock").addClass("pix-fadeDown"),o.filter(".pix-swing").removeClass("pix-swing").addClass("pix-fadeDown"),o.filter(".pix-turnBackward").removeClass("pix-turnBackward").addClass("pix-fadeRight"),o.filter(".pix-turnForward").removeClass("pix-turnForward").addClass("pix-fadeLeft")),o.is(".none, .available, .pix-fadeIn, .pix-fadeDown, .pix-fadeUp, .pix-fadeLeft, .pix-fadeRight, .pix-zoomIn, .pix-zoomOut, .pix-rotateIn, .pix-rotateOut, .pix-flipClock, .pix-swing, .pix-turnBackward, .pix-turnForward")||"undefined"==typeof pixgridder_fx||o.addClass(pixgridder_fx);var l=function(){o.addClass("pix-transended").removeClass("pix-loaded").removeClass("pix-fadeIn").removeClass("pix-fadeDown").removeClass("pix-fadeUp").removeClass("pix-fadeLeft").removeClass("pix-fadeRight").removeClass("pix-zoomIn").removeClass("pix-zoomOut").removeClass("pix-rotateIn").removeClass("pix-rotateOut").removeClass("pix-flipClock").removeClass("pix-swing").removeClass("pix-turnBackward").removeClass("pix-turnForward")},p=function(){Modernizr.cssanimations?(o.addClass("pix-loaded"),o.not(".pix-loaded").not(".available").not(".none").addClass("pix-loaded")):(o.not(".pix-loaded").addClass("pix-loaded-inanim"),t("body").removeClass("pix-scroll-load")),o.off("transitionend webkitTransitionEnd mozTransitionEnd oTransitionEnd"),o.on("transitionend webkitTransitionEnd mozTransitionEnd oTransitionEnd",function(){setTimeout(l,1e3)})};o.hasClass("none")||o.hasClass("bx-clone")?l():setTimeout(p,a)})},e.init=function(){e.rotatingFrames(),e.pixgridderParallax(),e.pixgridderFirstInARow(),e.initPixElem()},t(function(){e.init(),t(window).trigger("resize")}),t(window).on("pixgridder",function(){e.init(),t(window).trigger("resize")})}(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment