shapedivider.min.js
2.09 KB
this.sliderElement.one("SliderResponsiveStarted",$.proxy(function(){var e=this.sliderElement.find(".n2-ss-shape-divider");e.length&&e.each($.proxy(function(e,t){var i=$(t),n={outer:i,inner:i.find(".n2-ss-shape-divider-inner")};this.sliderElement.on("SliderDeviceOrientation",function(e,t){for(var i=t.device.toLowerCase()+t.orientation.toLowerCase(),s=0;s<n.outer.length;s++){var r=n.outer.eq(s),o=n.inner.eq(s),a=r.data(i+"height"),d=o.data(i+"width");0>=a?r.css("display","none"):r.css("display",""),""===a&&(a=r.data("desktopportraitheight")),r.css("height",a+"px"),""==d&&(d=o.data("desktopportraitwidth")),o.css({width:d+"%",marginLeft:(d-100)/-2+"%"})}}),i.hasClass("n2-ss-divider-animate")&&this.visible(function(){var e=i.find(".n2-ss-divider-start > *"),t=i.find(".n2-ss-divider-end > *"),n={};e.parent().attr("yoyo")&&(n={onComplete:function(){this.reverse()},onReverseComplete:function(){this.restart()}});for(var s=0;s<e.length;s++)NextendTween.to(e[s],parseFloat(e.eq(s).attr("duration")),$.extend({morphSVG:t[s],delay:0,ease:"easeOutCubic"},n,{delay:e.eq(s).attr("delay"),ease:e.eq(s).attr("ease")}))});var s=i.data("scroll");if("shrink"==s||"grow"==s){var r,o,a=i.data("side"),d=function(){var e=0;if(window.matchMedia&&/Android|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent||navigator.vendor||window.opera)){var t;t=n2const.isIOS?document.documentElement.clientHeight:window.innerHeight,e=window.matchMedia("(orientation: landscape)").matches?Math.min(screen.width,t):Math.min(screen.height,t)}else e=window.n2ClientHeight||document.documentElement.clientHeight||document.body.clientHeight;return e},h=$.proxy(function(e,t){var i=d(),s=this.sliderElement.offset().top+e,o=$(window).scrollTop();(o+i>=s&&s>=o||r>0&&100>r)&&(r=Math.max(0,Math.min(100,Math.abs(t-(s-o)/i*100))),n.inner.css("height",r+"%"))},this);"shrink"==s?(n.inner.css("height","100%"),r=100,o=$.proxy(function(){h("bottom"==a?this.sliderElement.height():0,0)},this)):"grow"==s&&(n.inner.css("height",0),r=0,o=$.proxy(function(){h("bottom"==a?this.sliderElement.height():0,100)},this)),$(window).on({scroll:o,resize:o}),this.visible(o)}},this))},this));