/* Name: Theme Base Written by: Okler Themes - (http://www.okler.net) Theme Version: 9.2.0 */ // Theme window.theme = {}; // Theme Common Functions window.theme.fn = { getOptions: function(opts) { if (typeof(opts) == 'object') { return opts; } else if (typeof(opts) == 'string') { try { return JSON.parse(opts.replace(/'/g,'"').replace(';','')); } catch(e) { return {}; } } else { return {}; } }, execPluginFunction: function( functionName, context ) { var args = Array.prototype.slice.call(arguments, 2); var namespaces = functionName.split("."); var func = namespaces.pop(); for(var i = 0; i < namespaces.length; i++) { context = context[namespaces[i]]; } return context[func].apply(context, args); }, intObs: function(selector, functionName, intObsOptions, alwaysObserve) { var $el = document.querySelectorAll( selector ); var intersectionObserverOptions = { rootMargin: '0px 0px 200px 0px' } if( Object.keys(intObsOptions).length ) { intersectionObserverOptions = $.extend(intersectionObserverOptions, intObsOptions); } var observer = new IntersectionObserver(function(entries) { for(var i=0; i < entries.length; i++) { var entry = entries[i]; if (entry.intersectionRatio > 0 ) { if( typeof functionName === 'string' ) { var func = Function( 'return ' + functionName )(); } else { var callback = functionName; callback.call( $(entry.target) ); } // Unobserve if( !alwaysObserve ) { observer.unobserve(entry.target); } } } }, intersectionObserverOptions); $( $el ).each(function(){ observer.observe( $(this)[0] ); }); }, intObsInit: function(selector, functionName) { var $el = document.querySelectorAll( selector ); var intersectionObserverOptions = { rootMargin: '200px' } var observer = new IntersectionObserver(function(entries) { for(var i=0; i < entries.length; i++) { var entry = entries[i]; if (entry.intersectionRatio > 0) { var $this = $(entry.target), opts; var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); if (pluginOptions) opts = pluginOptions; theme.fn.execPluginFunction(functionName, $this, opts); // Unobserve observer.unobserve(entry.target); } } }, intersectionObserverOptions); $( $el ).each(function(){ observer.observe( $(this)[0] ); }); }, dynIntObsInit: function(selector, functionName, pluginDefaults) { var $el = document.querySelectorAll( selector ); $( $el ).each(function(){ var $this = $(this), opts; var pluginOptions = theme.fn.getOptions($this.data('plugin-options')); if (pluginOptions) opts = pluginOptions; var mergedPluginDefaults = theme.fn.mergeOptions( pluginDefaults, opts ) var intersectionObserverOptions = { rootMargin: theme.fn.getRootMargin( functionName, mergedPluginDefaults ), threshold: 0 } if(!mergedPluginDefaults.forceInit) { var observer = new IntersectionObserver(function(entries) { for(var i=0; i < entries.length; i++) { var entry = entries[i]; if (entry.intersectionRatio > 0) { theme.fn.execPluginFunction(functionName, $this, mergedPluginDefaults); // Unobserve observer.unobserve(entry.target); } } }, intersectionObserverOptions); observer.observe( $this[0] ); } else { theme.fn.execPluginFunction(functionName, $this, mergedPluginDefaults); } }); }, getRootMargin: function(plugin, pluginDefaults) { switch ( plugin ) { case 'themePluginCounter': return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px'; break; case 'themePluginAnimate': return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px'; break; case 'themePluginIcon': return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px'; break; case 'themePluginRandomImages': return pluginDefaults.accY ? '0px 0px ' + pluginDefaults.accY + 'px 0px' : '0px 0px 200px 0px'; break; default: return '0px 0px 200px 0px'; break; } }, mergeOptions: function(obj1, obj2){ var obj3 = {}; for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; } for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; } return obj3; }, execOnceTroughEvent: function( $el, event, callback ) { var self = this, dataName = self.formatDataName( event ); $($el).on(event, function(){ if(!$(this).data(dataName) ) { // Exec Callback Function callback.call($(this)); // Add data name $(this).data( dataName, true ); // Unbind event $(this).off( event ); } }); return this; }, execOnceTroughWindowEvent: function( $el, event, callback ) { var self = this, dataName = self.formatDataName( event ); $($el).on(event, function(){ if(!$(this).data(dataName) ) { // Exec Callback Function callback(); // Add data name $(this).data( dataName, true ); // Unbind event $(this).off( event ); } }); return this; }, formatDataName: function( name ) { name = name.replace('.', ''); return name; }, isElementInView: function( $el ) { var rect = $el[0].getBoundingClientRect(); return ( rect.top <= ( window.innerHeight / 3 ) ); } }; /** * Copyright 2016 Google Inc. All Rights Reserved. * * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE. * * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document * */ !function(){"use strict";if("object"==typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var t=function(t){for(var e=window.document,o=i(e);o;)o=i(e=o.ownerDocument);return e}(),e=[],o=null,n=null;s.prototype.THROTTLE_TIMEOUT=100,s.prototype.POLL_INTERVAL=null,s.prototype.USE_MUTATION_OBSERVER=!0,s._setupCrossOriginUpdater=function(){return o||(o=function(t,o){n=t&&o?l(t,o):{top:0,bottom:0,left:0,right:0,width:0,height:0},e.forEach(function(t){t._checkForIntersections()})}),o},s._resetCrossOriginUpdater=function(){o=null,n=null},s.prototype.observe=function(t){if(!this._observationTargets.some(function(e){return e.element==t})){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},s.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._unmonitorIntersections(t.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},s.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},s.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},s.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,o){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==o[e-1]})},s.prototype._parseRootMargin=function(t){var e=(t||"0px").split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return e[1]=e[1]||e[0],e[2]=e[2]||e[0],e[3]=e[3]||e[1],e},s.prototype._monitorIntersections=function(e){var o=e.defaultView;if(o&&-1==this._monitoringDocuments.indexOf(e)){var n=this._checkForIntersections,r=null,s=null;this.POLL_INTERVAL?r=o.setInterval(n,this.POLL_INTERVAL):(h(o,"resize",n,!0),h(e,"scroll",n,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in o&&(s=new o.MutationObserver(n)).observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),this._monitoringDocuments.push(e),this._monitoringUnsubscribes.push(function(){var t=e.defaultView;t&&(r&&t.clearInterval(r),c(t,"resize",n,!0)),c(e,"scroll",n,!0),s&&s.disconnect()});var u=this.root&&(this.root.ownerDocument||this.root)||t;if(e!=u){var a=i(e);a&&this._monitorIntersections(a.ownerDocument)}}},s.prototype._unmonitorIntersections=function(e){var o=this._monitoringDocuments.indexOf(e);if(-1!=o){var n=this.root&&(this.root.ownerDocument||this.root)||t;if(!this._observationTargets.some(function(t){var o=t.element.ownerDocument;if(o==e)return!0;for(;o&&o!=n;){var r=i(o);if((o=r&&r.ownerDocument)==e)return!0}return!1})){var r=this._monitoringUnsubscribes[o];if(this._monitoringDocuments.splice(o,1),this._monitoringUnsubscribes.splice(o,1),r(),e!=n){var s=i(e);s&&this._unmonitorIntersections(s.ownerDocument)}}}},s.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e=0&&m>=0&&{top:c,bottom:a,left:f,right:d,width:g,height:m}||null),!v)break;_=_&&p(_)}return v}},s.prototype._getRootRect=function(){var e;if(this.root&&!d(this.root))e=u(this.root);else{var o=d(this.root)?this.root:t,n=o.documentElement,i=o.body;e={top:0,left:0,right:n.clientWidth||i.clientWidth,width:n.clientWidth||i.clientWidth,bottom:n.clientHeight||i.clientHeight,height:n.clientHeight||i.clientHeight}}return this._expandRectByRootMargin(e)},s.prototype._expandRectByRootMargin=function(t){var e=this._rootMarginValues.map(function(e,o){return"px"==e.unit?e.value:e.value*(o%2?t.width:t.height)/100}),o={top:t.top-e[0],right:t.right+e[1],bottom:t.bottom+e[2],left:t.left-e[3]};return o.width=o.right-o.left,o.height=o.bottom-o.top,o},s.prototype._hasCrossedThreshold=function(t,e){var o=t&&t.isIntersecting?t.intersectionRatio||0:-1,n=e.isIntersecting?e.intersectionRatio||0:-1;if(o!==n)for(var i=0;i -1; }, g = 'gecko', w = 'webkit', s = 'safari', o = 'opera', h = document.documentElement, b = [(!(/opera|webtv/i.test(ua)) && /msie\s(\d)/.test(ua)) ? ('ie ie' + parseFloat(navigator.appVersion.split("MSIE")[1])) : is('firefox/2') ? g + ' ff2' : is('firefox/3.5') ? g + ' ff3 ff3_5' : is('firefox/3') ? g + ' ff3' : is('gecko/') ? g : is('opera') ? o + (/version\/(\d+)/.test(ua) ? ' ' + o + RegExp.jQuery1 : (/opera(\s|\/)(\d+)/.test(ua) ? ' ' + o + RegExp.jQuery2 : '')) : is('konqueror') ? 'konqueror' : is('chrome') ? w + ' chrome' : is('iron') ? w + ' iron' : is('applewebkit/') ? w + ' ' + s + (/version\/(\d+)/.test(ua) ? ' ' + s + RegExp.jQuery1 : '') : is('mozilla/') ? g : '', is('j2me') ? 'mobile' : is('iphone') ? 'iphone' : is('ipod') ? 'ipod' : is('mac') ? 'mac' : is('darwin') ? 'mac' : is('webtv') ? 'webtv' : is('win') ? 'win' : is('freebsd') ? 'freebsd' : (is('x11') || is('linux')) ? 'linux' : '', 'js']; c = b.join(' '); if ($.browser.mobile) { c += ' mobile'; } if (hasTouch) { c += ' touch'; } h.className += ' ' + c; // Edge Detect var isEdge = /Edge/.test(navigator.userAgent); if(isEdge) { $('html').removeClass('chrome').addClass('edge'); } // IE11 Detect var isIE11 = !(window.ActiveXObject) && "ActiveXObject" in window; if (isIE11) { $('html').removeClass('gecko').addClass('ie ie11'); return; } // Dark and Boxed Compatibility if($('body').hasClass('dark')) { $('html').addClass('dark'); } if($('body').hasClass('boxed')) { $('html').addClass('boxed'); } } }); $.browserSelector(); /* Global Variable For Screen Size */ theme.globalWindowWidth = $(window).width(); var globalWindowWidth = $(window).width(); window.onresize = function() { theme.globalWindowWidth = $(window).width(); } /* Browser Workarounds */ if (/iPad|iPhone|iPod/.test(navigator.platform)) { // iPad/Iphone/iPod Hover Workaround $(document).ready(function($) { $('.thumb-info').attr('onclick', 'return true'); }); } /* Tabs */ if( $('a[data-bs-toggle="tab"]').length ) { $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) { var $tabPane = $($(e.target).attr('href')); // Carousel Refresh if($tabPane.length) { $tabPane.find('.owl-carousel').trigger('refresh.owl.carousel'); } // Change Active Class $(this).parents('.nav-tabs').find('.active').removeClass('active'); $(this).addClass('active').parent().addClass('active'); }); if( window.location.hash ) { $(window).on('load', function(){ if( window.location.hash !== '*' && $( window.location.hash ).get(0) ) { new bootstrap.Tab( $('a.nav-link[href="'+ window.location.hash +'"]:not([data-hash])')[0] ).show(); } }); } } /* On Load Scroll */ if( !$('html').hasClass('disable-onload-scroll') && window.location.hash && !['#*'].includes( window.location.hash ) ) { window.scrollTo(0, 0); $(window).on('load', function() { setTimeout(function() { var target = window.location.hash, offset = ( $(window).width() < 768 ) ? 180 : 90; if (!$(target).length) { return; } if ( $("a[href$='" + window.location.hash + "']").is('[data-hash-offset]') ) { offset = parseInt( $("a[href$='" + window.location.hash + "']").first().attr('data-hash-offset') ); } else if ( $("html").is('[data-hash-offset]') ) { offset = parseInt( $("html").attr('data-hash-offset') ); } if (isNaN(offset)) { offset = 0; } $('body').addClass('scrolling'); $('html, body').animate({ scrollTop: $(target).offset().top - offset }, 600, 'easeOutQuad', function() { $('body').removeClass('scrolling'); }); }, 1); }); } /* * Text Rotator */ $.fn.extend({ textRotator: function(options) { var defaults = { fadeSpeed: 500, pauseSpeed: 100, child: null }; var options = $.extend(defaults, options); return this.each(function() { var o = options; var obj = $(this); var items = $(obj.children(), obj); items.each(function() { $(this).hide(); }) if (!o.child) { var next = $(obj).children(':first'); } else { var next = o.child; } $(next).fadeIn(o.fadeSpeed, function() { $(next).delay(o.pauseSpeed).fadeOut(o.fadeSpeed, function() { var next = $(this).next(); if (next.length == 0) { next = $(obj).children(':first'); } $(obj).textRotator({ child: next, fadeSpeed: o.fadeSpeed, pauseSpeed: o.pauseSpeed }); }) }); }); } }); /* * Notice Top bar */ var $noticeTopBar = { $wrapper: $('.notice-top-bar'), $closeBtn: $('.notice-top-bar-close'), $header: $('#header'), $body: $('.body'), init: function() { var self = this; if( !$.cookie('portoNoticeTopBarClose') ) { self .build() .events(); } else { self.$wrapper.parent().prepend( '' ); self.$wrapper.remove(); } return this; }, build: function(){ var self = this; $(window).on('load', function(){ setTimeout(function(){ self.$body.css({ 'margin-top': self.$wrapper.outerHeight(), 'transition': 'ease margin 300ms' }); $('#noticeTopBarContent').textRotator({ fadeSpeed: 500, pauseSpeed: 5000 }); if( ['absolute', 'fixed'].includes( self.$header.css('position') ) ) { self.$header.css({ 'top': self.$wrapper.outerHeight(), 'transition': 'ease top 300ms' }); } $(window).trigger('notice.top.bar.opened'); }, 1000); }); return this; }, events: function() { var self = this; self.$closeBtn.on('click', function(e){ e.preventDefault(); self.$body.animate({ 'margin-top': 0, }, 300, function(){ self.$wrapper.remove(); self.saveCookie(); }); if( ['absolute', 'fixed'].includes( self.$header.css('position') ) ) { self.$header.animate({ top: 0 }, 300); } // When header has shrink effect if( self.$header.hasClass('header-effect-shrink') ) { self.$header.find('.header-body').animate({ top: 0 }, 300); } $(window).trigger('notice.top.bar.closed'); }); return this; }, checkCookie: function(){ var self = this; if( $.cookie('portoNoticeTopBarClose') ) { return true; } else { return false; } return this; }, saveCookie: function() { var self = this; $.cookie('portoNoticeTopBarClose', true); return this; } } if( $('.notice-top-bar').length ) { $noticeTopBar.init(); } /* * Image Hotspots */ if( $('.image-hotspot').length ) { $('.image-hotspot') .append('') .append(''); } /* * Page Transition */ if( $('body[data-plugin-page-transition]').length ) { var link_click = false; $(document).on('click', 'a', function(e){ link_click = $(this); }); $(window).on("beforeunload", function(e) { if( typeof link_click === 'object' ) { var href = link_click.attr('href'); if( href.indexOf('mailto:') != 0 && href.indexOf('tel:') != 0 && !link_click.data('rm-from-transition') ) { $('body').addClass('page-transition-active'); } } }); $(window).on("pageshow", function(e){ if( e.persisted ) { if( $('html').hasClass('safari') ) { window.location.reload(); } $('body').removeClass('page-transition-active'); } }); } /* * Thumb Info Floating Caption */ if( $('.thumb-info-floating-caption').length ) { $('.thumb-info-floating-caption').on('mouseenter', function(){ if( !$('.thumb-info-floating-caption-title').length ) { $('.body').append( '
'+ $(this).data('title') +'
' ); if( $(this).data('type') ) { $('.thumb-info-floating-caption-title') .append( '
'+ $(this).data('type') +'
' ) .css({ 'padding-bottom' : 22 }); } if( $(this).hasClass('thumb-info-floating-caption-clean') ) { $('.thumb-info-floating-caption-title').addClass('bg-transparent'); } } }).on('mouseout', function(){ $('.thumb-info-floating-caption-title').remove(); }); $(document).on('mousemove', function(e){ $('.thumb-info-floating-caption-title').css({ position: 'fixed', left: e.clientX - 20, top: e.clientY + 20 }); }); } /* * Toggle Text Click */ $('[data-toggle-text-click]').on('click', function () { $(this).text(function(i, text){ return text === $(this).attr('data-toggle-text-click') ? $(this).attr('data-toggle-text-click-alt') : $(this).attr('data-toggle-text-click'); }); }); /* * Shape Divider Aspect Ratio */ if( $('.shape-divider').length ) { aspectRatioSVG(); $(window).on('resize', function(){ aspectRatioSVG(); }); } /* * Shape Divider Animated */ if( $('.shape-divider-horizontal-animation').length ) { theme.fn.intObs('.shape-divider-horizontal-animation', function(){ for( var i = 0; i <= 1; i++ ) { var svgClone = $(this).find('svg:nth-child(1)').clone(); $(this).append( svgClone ) } $(this).addClass('start'); }, {}); } /* * Toggle Class */ $('[data-porto-toggle-class]').on('click', function (e) { e.preventDefault(); $(this).toggleClass( $(this).data('porto-toggle-class') ); }); /* * Dynamic Height */ var $window = $(window); $window.on('resize dynamic.height.resize', function(){ $('[data-dynamic-height]').each(function(){ var $this = $(this), values = JSON.parse($this.data('dynamic-height').replace(/'/g,'"').replace(';','')) // XS if( $window.width() < 576 ) { $this.height( values[4] ); } // SM if( $window.width() > 575 && $window.width() < 768 ) { $this.height( values[3] ); } // MD if( $window.width() > 767 && $window.width() < 992 ) { $this.height( values[2] ); } // LG if( $window.width() > 991 && $window.width() < 1200 ) { $this.height( values[1] ); } // XS if( $window.width() > 1199 ) { $this.height( values[0] ); } }); }); // Mobile First Load if( $window.width() < 992 ) { $window.trigger('dynamic.height.resize'); } /* Video - Trigger Play */ if( $('[data-trigger-play-video]').length ) { theme.fn.execOnceTroughEvent( '[data-trigger-play-video]', 'mouseover.trigger.play.video', function(){ var $video = $( $(this).data('trigger-play-video') ); $(this).on('click', function(e){ e.preventDefault(); if( $(this).data('trigger-play-video-remove') == 'yes' ) { $(this).animate({ opacity: 0 }, 300, function(){ $video[0].play(); $(this).remove(); }); } else { setTimeout(function(){ $video[0].play(); },300); } }); }); } /* Video - Custom Auto Play */ if( $('video[data-auto-play]').length ) { $(window).on('load', function(){ $('video[data-auto-play]').each(function(){ var $video = $(this); setTimeout(function(){ if( $( '#' + $video.attr('id') ).length ) { if( $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).data('trigger-play-video-remove') == 'yes' ) { $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).animate({ opacity: 0 }, 300, function(){ $video[0].play(); $( '[data-trigger-play-video="#' + $video.attr('id') + '"]' ).remove(); }); } else { setTimeout(function(){ $video[0].play(); },300); } } }, 100); }); }); } /* * Remove min height after the load of page */ if( $('[data-remove-min-height]').length ) { $(window).on('load', function(){ $('[data-remove-min-height]').each(function(){ $(this).css({ 'min-height': 0 }); }); }); } /* * Style Switcher Open Loader Button */ if( $('.style-switcher-open-loader').length ) { $('.style-switcher-open-loader').on('click', function(e){ e.preventDefault(); var $this = $(this); // Add Spinner to icon $this.addClass('style-switcher-open-loader-loading'); var basePath = $(this).data('base-path'), skinSrc = $(this).data('skin-src'); var script1 = document.createElement("script"); script1.src = basePath + "master/style-switcher/style.switcher.localstorage.js"; var script2 = document.createElement("script"); script2.src = basePath + "master/style-switcher/style.switcher.js"; script2.id = "styleSwitcherScript"; script2.setAttribute('data-base-path', basePath); script2.setAttribute('data-skin-src', skinSrc); script2.onload = function() { setTimeout(function(){ // Trigger a click to open the style switcher sidebar function checkIfReady() { if( !$('.style-switcher-open').length ) { window.setTimeout(checkIfReady, 100); } else { $('.style-switcher-open').trigger('click'); } } checkIfReady(); }, 500); } document.body.appendChild(script1); document.body.appendChild(script2); }); } })(jQuery); /* * Scroll and Focus */ function scrollAndFocus($this, scrollTarget, focusTarget, scrollOffset, scrollAgain) { (function($) { $('body').addClass('scrolling'); // if it's inside a header menu if( $($this).closest('#mainNav').length ) { $($this).parents('.collapse.show').collapse('hide'); } $('html, body').animate({ scrollTop: $(scrollTarget).offset().top - (scrollOffset ? scrollOffset : 0) }, 300, function() { $('body').removeClass('scrolling'); setTimeout(function(){ $(focusTarget).focus(); }, 500); if( scrollAgain ) { $('html, body').animate({ scrollTop: $(scrollTarget).offset().top - (scrollOffset ? scrollOffset : 0) }); } }); })(jQuery); } /* * Shape Divider - SVG Aspect Ratio */ function aspectRatioSVG() { if( $(window).width() < 1950 ) { $('.shape-divider svg[preserveAspectRatio]').each(function(){ if( !$(this).parent().hasClass('shape-divider-horizontal-animation') ) { $(this).attr('preserveAspectRatio', 'xMinYMin'); } else { $(this).attr('preserveAspectRatio', 'none'); } }); } else { $('.shape-divider svg[preserveAspectRatio]').each(function(){ $(this).attr('preserveAspectRatio', 'none'); }); } } /* * Lazy Load Background Images (with lazySizes plugin) */ document.addEventListener('lazybeforeunveil', function(e){ var bg = e.target.getAttribute('data-bg-src'); if(bg) { e.target.style.backgroundImage = 'url(' + bg + ')'; } }); (function (factory) { if (typeof define === 'function' && define.amd) { // AMD define(['jquery'], factory); } else if (typeof exports === 'object') { // CommonJS factory(require('jquery')); } else { // Browser globals factory(jQuery); } }(function ($) { var CountTo = function (element, options) { this.$element = $(element); this.options = $.extend({}, CountTo.DEFAULTS, this.dataOptions(), options); this.init(); }; CountTo.DEFAULTS = { from: 0, // the number the element should start at to: 0, // the number the element should end at speed: 1000, // how long it should take to count between the target numbers refreshInterval: 100, // how often the element should be updated decimals: 0, // the number of decimal places to show formatter: formatter, // handler for formatting the value before rendering onUpdate: null, // callback method for every time the element is updated onComplete: null // callback method for when the element finishes updating }; CountTo.prototype.init = function () { this.value = this.options.from; this.loops = Math.ceil(this.options.speed / this.options.refreshInterval); this.loopCount = 0; this.increment = (this.options.to - this.options.from) / this.loops; }; CountTo.prototype.dataOptions = function () { var options = { from: this.$element.data('from'), to: this.$element.data('to'), speed: this.$element.data('speed'), refreshInterval: this.$element.data('refresh-interval'), decimals: this.$element.data('decimals') }; var keys = Object.keys(options); for (var i in keys) { var key = keys[i]; if (typeof(options[key]) === 'undefined') { delete options[key]; } } return options; }; CountTo.prototype.update = function () { this.value += this.increment; this.loopCount++; this.render(); if (typeof(this.options.onUpdate) == 'function') { this.options.onUpdate.call(this.$element, this.value); } if (this.loopCount >= this.loops) { clearInterval(this.interval); this.value = this.options.to; if (typeof(this.options.onComplete) == 'function') { this.options.onComplete.call(this.$element, this.value); } } }; CountTo.prototype.render = function () { var formattedValue = this.options.formatter.call(this.$element, this.value, this.options); this.$element.text(formattedValue); }; CountTo.prototype.restart = function () { this.stop(); this.init(); this.start(); }; CountTo.prototype.start = function () { this.stop(); this.render(); this.interval = setInterval(this.update.bind(this), this.options.refreshInterval); }; CountTo.prototype.stop = function () { if (this.interval) { clearInterval(this.interval); } }; CountTo.prototype.toggle = function () { if (this.interval) { this.stop(); } else { this.start(); } }; function formatter(value, options) { return value.toFixed(options.decimals); } $.fn.countTo = function (option) { return this.each(function () { var $this = $(this); var data = $this.data('countTo'); var init = !data || typeof(option) === 'object'; var options = typeof(option) === 'object' ? option : {}; var method = typeof(option) === 'string' ? option : 'start'; if (init) { if (data) data.stop(); $this.data('countTo', data = new CountTo(this, options)); } data[method].call(data); }); }; })); (function($){ /** * Copyright 2012, Digital Fusion * Licensed under the MIT license. * http://teamdf.com/jquery-plugins/license/ * * @author Sam Sehnert * @desc A small plugin that checks whether elements are within * the user visible viewport of a web browser. * only accounts for vertical position, not horizontal. */ $.fn.visible = function(partial,hidden,direction,container){ if (this.length < 1) return; var $t = this.length > 1 ? this.eq(0) : this, isContained = typeof container !== 'undefined' && container !== null, $w = isContained ? $(container) : $(window), wPosition = isContained ? $w.position() : 0, t = $t.get(0), vpWidth = $w.outerWidth(), vpHeight = $w.outerHeight(), direction = (direction) ? direction : 'both', clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true; if (typeof t.getBoundingClientRect === 'function'){ // Use this native browser method, if available. var rec = t.getBoundingClientRect(), tViz = isContained ? rec.top - wPosition.top >= 0 && rec.top < vpHeight + wPosition.top : rec.top >= 0 && rec.top < vpHeight, bViz = isContained ? rec.bottom - wPosition.top > 0 && rec.bottom <= vpHeight + wPosition.top : rec.bottom > 0 && rec.bottom <= vpHeight, lViz = isContained ? rec.left - wPosition.left >= 0 && rec.left < vpWidth + wPosition.left : rec.left >= 0 && rec.left < vpWidth, rViz = isContained ? rec.right - wPosition.left > 0 && rec.right < vpWidth + wPosition.left : rec.right > 0 && rec.right <= vpWidth, vVisible = partial ? tViz || bViz : tViz && bViz, hVisible = partial ? lViz || rViz : lViz && rViz; if(direction === 'both') return clientSize && vVisible && hVisible; else if(direction === 'vertical') return clientSize && vVisible; else if(direction === 'horizontal') return clientSize && hVisible; } else { var viewTop = isContained ? 0 : wPosition, viewBottom = viewTop + vpHeight, viewLeft = $w.scrollLeft(), viewRight = viewLeft + vpWidth, position = $t.position(), _top = position.top, _bottom = _top + $t.height(), _left = position.left, _right = _left + $t.width(), compareTop = partial === true ? _bottom : _top, compareBottom = partial === true ? _top : _bottom, compareLeft = partial === true ? _right : _left, compareRight = partial === true ? _left : _right; if(direction === 'both') return !!clientSize && ((compareBottom <= viewBottom) && (compareTop >= viewTop)) && ((compareRight <= viewRight) && (compareLeft >= viewLeft)); else if(direction === 'vertical') return !!clientSize && ((compareBottom <= viewBottom) && (compareTop >= viewTop)); else if(direction === 'horizontal') return !!clientSize && ((compareRight <= viewRight) && (compareLeft >= viewLeft)); } }; })(jQuery); /** * jquery-match-height 0.7.2 by @liabru * http://brm.io/jquery-match-height/ * License: MIT */ ;(function(factory) { // eslint-disable-line no-extra-semi 'use strict'; if (typeof define === 'function' && define.amd) { // AMD define(['jquery'], factory); } else if (typeof module !== 'undefined' && module.exports) { // CommonJS module.exports = factory(require('jquery')); } else { // Global factory(jQuery); } })(function($) { /* * internal */ var _previousResizeWidth = -1, _updateTimeout = -1; /* * _parse * value parse utility function */ var _parse = function(value) { // parse value and convert NaN to 0 return parseFloat(value) || 0; }; /* * _rows * utility function returns array of jQuery selections representing each row * (as displayed after float wrapping applied by browser) */ var _rows = function(elements) { var tolerance = 1, $elements = $(elements), lastTop = null, rows = []; // group elements by their top position $elements.each(function(){ var $that = $(this), top = $that.offset().top - _parse($that.css('margin-top')), lastRow = rows.length > 0 ? rows[rows.length - 1] : null; if (lastRow === null) { // first item on the row, so just push it rows.push($that); } else { // if the row top is the same, add to the row group if (Math.floor(Math.abs(lastTop - top)) <= tolerance) { rows[rows.length - 1] = lastRow.add($that); } else { // otherwise start a new row group rows.push($that); } } // keep track of the last row top lastTop = top; }); return rows; }; /* * _parseOptions * handle plugin options */ var _parseOptions = function(options) { var opts = { byRow: true, property: 'height', target: null, remove: false }; if (typeof options === 'object') { return $.extend(opts, options); } if (typeof options === 'boolean') { opts.byRow = options; } else if (options === 'remove') { opts.remove = true; } return opts; }; /* * matchHeight * plugin definition */ var matchHeight = $.fn.matchHeight = function(options) { var opts = _parseOptions(options); // handle remove if (opts.remove) { var that = this; // remove fixed height from all selected elements this.css(opts.property, ''); // remove selected elements from all groups $.each(matchHeight._groups, function(key, group) { group.elements = group.elements.not(that); }); // TODO: cleanup empty groups return this; } if (this.length <= 1 && !opts.target) { return this; } // keep track of this group so we can re-apply later on load and resize events matchHeight._groups.push({ elements: this, options: opts }); // match each element's height to the tallest element in the selection matchHeight._apply(this, opts); return this; }; /* * plugin global options */ matchHeight.version = '0.7.2'; matchHeight._groups = []; matchHeight._throttle = 80; matchHeight._maintainScroll = false; matchHeight._beforeUpdate = null; matchHeight._afterUpdate = null; matchHeight._rows = _rows; matchHeight._parse = _parse; matchHeight._parseOptions = _parseOptions; /* * matchHeight._apply * apply matchHeight to given elements */ matchHeight._apply = function(elements, options) { var opts = _parseOptions(options), $elements = $(elements), rows = [$elements]; // take note of scroll position var scrollTop = $(window).scrollTop(), htmlHeight = $('html').outerHeight(true); // get hidden parents var $hiddenParents = $elements.parents().filter(':hidden'); // cache the original inline style $hiddenParents.each(function() { var $that = $(this); $that.data('style-cache', $that.attr('style')); }); // temporarily must force hidden parents visible $hiddenParents.css('display', 'block'); // get rows if using byRow, otherwise assume one row if (opts.byRow && !opts.target) { // must first force an arbitrary equal height so floating elements break evenly $elements.each(function() { var $that = $(this), display = $that.css('display'); // temporarily force a usable display value if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { display = 'block'; } // cache the original inline style $that.data('style-cache', $that.attr('style')); $that.css({ 'display': display, 'padding-top': '0', 'padding-bottom': '0', 'margin-top': '0', 'margin-bottom': '0', 'border-top-width': '0', 'border-bottom-width': '0', 'height': '100px', 'overflow': 'hidden' }); }); // get the array of rows (based on element top position) rows = _rows($elements); // revert original inline styles $elements.each(function() { var $that = $(this); $that.attr('style', $that.data('style-cache') || ''); }); } $.each(rows, function(key, row) { var $row = $(row), targetHeight = 0; if (!opts.target) { // skip apply to rows with only one item if (opts.byRow && $row.length <= 1) { $row.css(opts.property, ''); return; } // iterate the row and find the max height $row.each(function(){ var $that = $(this), style = $that.attr('style'), display = $that.css('display'); // temporarily force a usable display value if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { display = 'block'; } // ensure we get the correct actual height (and not a previously set height value) var css = { 'display': display }; css[opts.property] = ''; $that.css(css); // find the max height (including padding, but not margin) if ($that.outerHeight(false) > targetHeight) { targetHeight = $that.outerHeight(false); } // revert styles if (style) { $that.attr('style', style); } else { $that.css('display', ''); } }); } else { // if target set, use the height of the target element targetHeight = opts.target.outerHeight(false); } // iterate the row and apply the height to all elements $row.each(function(){ var $that = $(this), verticalPadding = 0; // don't apply to a target if (opts.target && $that.is(opts.target)) { return; } // handle padding and border correctly (required when not using border-box) if ($that.css('box-sizing') !== 'border-box') { verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width')); verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom')); } // set the height (accounting for padding and border) $that.css(opts.property, (targetHeight - verticalPadding) + 'px'); }); }); // revert hidden parents $hiddenParents.each(function() { var $that = $(this); $that.attr('style', $that.data('style-cache') || null); }); // restore scroll position if enabled if (matchHeight._maintainScroll) { $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true)); } return this; }; /* * matchHeight._applyDataApi * applies matchHeight to all elements with a data-match-height attribute */ matchHeight._applyDataApi = function() { var groups = {}; // generate groups by their groupId set by elements using data-match-height $('[data-match-height], [data-mh]').each(function() { var $this = $(this), groupId = $this.attr('data-mh') || $this.attr('data-match-height'); if (groupId in groups) { groups[groupId] = groups[groupId].add($this); } else { groups[groupId] = $this; } }); // apply matchHeight to each group $.each(groups, function() { this.matchHeight(true); }); }; /* * matchHeight._update * updates matchHeight on all current groups with their correct options */ var _update = function(event) { if (matchHeight._beforeUpdate) { matchHeight._beforeUpdate(event, matchHeight._groups); } $.each(matchHeight._groups, function() { matchHeight._apply(this.elements, this.options); }); if (matchHeight._afterUpdate) { matchHeight._afterUpdate(event, matchHeight._groups); } }; matchHeight._update = function(throttle, event) { // prevent update if fired from a resize event // where the viewport width hasn't actually changed // fixes an event looping bug in IE8 if (event && event.type === 'resize') { var windowWidth = $(window).width(); if (windowWidth === _previousResizeWidth) { return; } _previousResizeWidth = windowWidth; } // throttle updates if (!throttle) { _update(event); } else if (_updateTimeout === -1) { _updateTimeout = setTimeout(function() { _update(event); _updateTimeout = -1; }, matchHeight._throttle); } }; /* * bind events */ // apply on DOM ready event $(matchHeight._applyDataApi); // use on or bind where supported var on = $.fn.on ? 'on' : 'bind'; // update heights on load and resize events $(window)[on]('load', function(event) { matchHeight._update(false, event); }); // throttled update heights on resize events $(window)[on]('resize orientationchange', function(event) { matchHeight._update(true, event); }); }); /*! waitForImages jQuery Plugin - v2.4.0 - 2018-02-13 * https://github.com/alexanderdickson/waitForImages * Copyright (c) 2018 Alex Dickson; Licensed MIT */ ;(function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof exports === 'object') { // CommonJS / nodejs module module.exports = factory(require('jquery')); } else { // Browser globals factory(jQuery); } }(function ($) { // Namespace all events. var eventNamespace = 'waitForImages'; // Is srcset supported by this browser? var hasSrcset = (function(img) { return img.srcset && img.sizes; })(new Image()); // CSS properties which contain references to images. $.waitForImages = { hasImageProperties: [ 'backgroundImage', 'listStyleImage', 'borderImage', 'borderCornerImage', 'cursor' ], hasImageAttributes: ['srcset'] }; // Custom selector to find all `img` elements with a valid `src` attribute. $.expr.pseudos['has-src'] = function (obj) { // Ensure we are dealing with an `img` element with a valid // `src` attribute. return $(obj).is('img[src][src!=""]'); }; // Custom selector to find images which are not already cached by the // browser. $.expr.pseudos.uncached = function (obj) { // Ensure we are dealing with an `img` element with a valid // `src` attribute. if (!$(obj).is(':has-src')) { return false; } return !obj.complete; }; $.fn.waitForImages = function () { var allImgsLength = 0; var allImgsLoaded = 0; var deferred = $.Deferred(); var originalCollection = this; var allImgs = []; // CSS properties which may contain an image. var hasImgProperties = $.waitForImages.hasImageProperties || []; // Element attributes which may contain an image. var hasImageAttributes = $.waitForImages.hasImageAttributes || []; // To match `url()` references. // Spec: http://www.w3.org/TR/CSS2/syndata.html#value-def-uri var matchUrl = /url\(\s*(['"]?)(.*?)\1\s*\)/g; var finishedCallback; var eachCallback; var waitForAll; // Handle options object (if passed). if ($.isPlainObject(arguments[0])) { waitForAll = arguments[0].waitForAll; eachCallback = arguments[0].each; finishedCallback = arguments[0].finished; } else { // Handle if using deferred object and only one param was passed in. if (arguments.length === 1 && $.type(arguments[0]) === 'boolean') { waitForAll = arguments[0]; } else { finishedCallback = arguments[0]; eachCallback = arguments[1]; waitForAll = arguments[2]; } } // Handle missing callbacks. finishedCallback = finishedCallback || $.noop; eachCallback = eachCallback || $.noop; // Convert waitForAll to Boolean. waitForAll = !! waitForAll; // Ensure callbacks are functions. if (!$.isFunction(finishedCallback) || !$.isFunction(eachCallback)) { throw new TypeError('An invalid callback was supplied.'); } this.each(function () { // Build a list of all imgs, dependent on what images will // be considered. var obj = $(this); if (waitForAll) { // Get all elements (including the original), as any one of // them could have a background image. obj.find('*').addBack().each(function () { var element = $(this); // If an `img` element, add it. But keep iterating in // case it has a background image too. if (element.is('img:has-src') && !element.is('[srcset]')) { allImgs.push({ src: element.attr('src'), element: element[0] }); } $.each(hasImgProperties, function (i, property) { var propertyValue = element.css(property); var match; // If it doesn't contain this property, skip. if (!propertyValue) { return true; } // Get all url() of this element. while (match = matchUrl.exec(propertyValue)) { allImgs.push({ src: match[2], element: element[0] }); } }); $.each(hasImageAttributes, function (i, attribute) { var attributeValue = element.attr(attribute); var attributeValues; // If it doesn't contain this property, skip. if (!attributeValue) { return true; } allImgs.push({ src: element.attr('src'), srcset: element.attr('srcset'), element: element[0] }); }); }); } else { // For images only, the task is simpler. obj.find('img:has-src') .each(function () { allImgs.push({ src: this.src, element: this }); }); } }); allImgsLength = allImgs.length; allImgsLoaded = 0; // If no images found, don't bother. if (allImgsLength === 0) { finishedCallback.call(originalCollection); deferred.resolveWith(originalCollection); } // Now that we've found all imgs in all elements in this, // load them and attach callbacks. $.each(allImgs, function (i, img) { var image = new Image(); var events = 'load.' + eventNamespace + ' error.' + eventNamespace; // Handle the image loading and error with the same callback. $(image).one(events, function me (event) { // If an error occurred with loading the image, set the // third argument accordingly. var eachArguments = [ allImgsLoaded, allImgsLength, event.type == 'load' ]; allImgsLoaded++; eachCallback.apply(img.element, eachArguments); deferred.notifyWith(img.element, eachArguments); // Unbind the event listeners. I use this in addition to // `one` as one of those events won't be called (either // 'load' or 'error' will be called). $(this).off(events, me); if (allImgsLoaded == allImgsLength) { finishedCallback.call(originalCollection[0]); deferred.resolveWith(originalCollection[0]); return false; } }); if (hasSrcset && img.srcset) { image.srcset = img.srcset; image.sizes = img.sizes; } image.src = img.src; }); return deferred.promise(); }; })); /* jQuery-FontSpy.js v3.0.0 * https://github.com/patrickmarabeas/jQuery-FontSpy.js * * Copyright 2013, Patrick Marabeas http://pulse-dev.com * Released under the MIT license * http://opensource.org/licenses/mit-license.php * * Date: 02/11/2015 */ (function( w, $ ) { fontSpy = function ( fontName, conf ) { var $html = $('html'), $body = $('body'), fontFamilyName = fontName; // Throw error if fontName is not a string or not is left as an empty string if (typeof fontFamilyName !== 'string' || fontFamilyName === '') { throw 'A valid fontName is required. fontName must be a string and must not be an empty string.'; } var defaults = { font: fontFamilyName, fontClass: fontFamilyName.toLowerCase().replace( /\s/g, '' ), success: function() {}, failure: function() {}, testFont: 'Courier New', testString: 'QW@HhsXJ', glyphs: '', delay: 50, timeOut: 1000, callback: $.noop }; var config = $.extend( defaults, conf ); var $tester = $('' + config.testString+config.glyphs + '') .css('position', 'absolute') .css('top', '-9999px') .css('left', '-9999px') .css('visibility', 'hidden') .css('fontFamily', config.testFont) .css('fontSize', '250px'); $body.append($tester); var fallbackFontWidth = $tester.outerWidth(); $tester.css('fontFamily', config.font + ',' + config.testFont); var failure = function () { $html.addClass("no-"+config.fontClass); if( config && config.failure ) { config.failure(); } config.callback(new Error('FontSpy timeout')); $tester.remove(); }; var success = function () { config.callback(); $html.addClass(config.fontClass); if( config && config.success ) { config.success(); } $tester.remove(); }; var retry = function () { setTimeout(checkFont, config.delay); config.timeOut = config.timeOut - config.delay; }; var checkFont = function () { var loadedFontWidth = $tester.outerWidth(); if (fallbackFontWidth !== loadedFontWidth){ success(); } else if(config.timeOut < 0) { failure(); } else { retry(); } } checkFont(); } })( this, jQuery ); /* Plugin Name: jQuery.pin https://github.com/webpop/jquery.pin Licensed under the terms of the MIT license. */ (function ($) { "use strict"; $.fn.pin = function (options) { var scrollY = 0, elements = [], disabled = false, $window = $(window); options = options || {}; var recalculateLimits = function () { for (var i=0, len=elements.length; i"); } var pad = $.extend({ top: 0, bottom: 0 }, options.padding || {}); $this.data("pin", { pad: pad, from: (options.containerSelector ? containerOffset.top : offset.top) - pad.top, to: containerOffset.top + $container.height() - $this.outerHeight() - pad.bottom, end: containerOffset.top + $container.height(), parentTop: parentOffset.top }); $this.css({width: $this.outerWidth()}); $this.parent().css("height", $this.outerHeight()); } }; var onScroll = function () { if (disabled) { return; } scrollY = $window.scrollTop(); var elmts = []; for (var i=0, len=elements.length; i data.end) { $this.css('position', ''); continue; } if (from < scrollY && to > scrollY) { !($this.css("position") == "fixed") && $this.css({ left: $this.offset().left, top: data.pad.top }).css("position", "fixed"); if (options.activeClass) { $this.addClass(options.activeClass); } } else if (scrollY >= to) { $this.css({ left: "", top: to - data.parentTop + data.pad.top }).css("position", "absolute"); if (options.activeClass) { $this.addClass(options.activeClass); } } else { $this.css({position: "", top: "", left: ""}); if (options.activeClass) { $this.removeClass(options.activeClass); } } } elements = elmts; }; var update = function () { recalculateLimits(); onScroll(); }; this.each(function () { var $this = $(this), data = $(this).data('pin') || {}; if (data && data.update) { return; } elements.push($this); $("img", this).one("load", recalculateLimits); data.update = update; $(this).data('pin', data); }); $window.scroll(onScroll); $window.resize(function () { recalculateLimits(); }); recalculateLimits(); $window.on('load', update); return this; }; })(jQuery); ( function( $ ) { "use strict"; // Define default settings var defaults = { action: function() {}, runOnLoad: false, duration: 500 }; // Define global variables var settings = defaults, running = false, start; var methods = {}; // Initial plugin configuration methods.init = function() { // Allocate passed arguments to settings based on type for( var i = 0; i <= arguments.length; i++ ) { var arg = arguments[i]; switch ( typeof arg ) { case "function": settings.action = arg; break; case "boolean": settings.runOnLoad = arg; break; case "number": settings.duration = arg; break; } } // Process each matching jQuery object return this.each(function() { if( settings.runOnLoad ) { settings.action(); } $(this).resize( function() { methods.timedAction.call( this ); } ); } ); }; methods.timedAction = function( code, millisec ) { var doAction = function() { var remaining = settings.duration; if( running ) { var elapse = new Date() - start; remaining = settings.duration - elapse; if( remaining <= 0 ) { // Clear timeout and reset running variable clearTimeout(running); running = false; // Perform user defined function settings.action(); return; } } wait( remaining ); }; var wait = function( time ) { running = setTimeout( doAction, time ); }; // Define new action starting time start = new Date(); // Define runtime settings if function is run directly if( typeof millisec === 'number' ) { settings.duration = millisec; } if( typeof code === 'function' ) { settings.action = code; } // Only run timed loop if not already running if( !running ) { doAction(); } }; $.fn.afterResize = function( method ) { if( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ) ); } else { return methods.init.apply( this, arguments ); } }; })(jQuery); /* Plugin Name: Animated Headlines Written by: Codyhouse - (https://codyhouse.co/demo/animated-headlines/index.html) */ jQuery(document).ready(function($) { //set animation timing var animationDelay = 2500, //loading bar effect barAnimationDelay = 3800, barWaiting = barAnimationDelay - 3000, //3000 is the duration of the transition on the loading bar - set in the scss/css file //letters effect lettersDelay = 50, //type effect typeLettersDelay = 150, selectionDuration = 500, typeAnimationDelay = selectionDuration + 800, //clip effect revealDuration = 600, revealAnimationDelay = 1500; initHeadline(); function initHeadline() { //initialise headline animation animateHeadline('.word-rotator', '.word-rotator.letters'); } function animateHeadline($selector) { var duration = animationDelay; theme.fn.intObs($selector, function(){ // Single Letters - Insert element for each letter of a changing word if( $(this).hasClass('letters') ) { $(this).find('b').each(function() { var word = $(this), letters = word.text().split(''), selected = word.hasClass('is-visible'); for (i in letters) { if (word.parents('.rotate-2').length > 0) letters[i] = '' + letters[i] + ''; letters[i] = (selected) ? '' + letters[i] + '' : '' + letters[i] + ''; } var newLetters = letters.join(''); word.html(newLetters).css('opacity', 1); }); } // Animate the Headline var headline = $(this); if (headline.hasClass('loading-bar')) { duration = barAnimationDelay; setTimeout(function() { headline.find('.word-rotator-words').addClass('is-loading') }, barWaiting); } else if (headline.hasClass('clip')) { var spanWrapper = headline.find('.word-rotator-words'), newWidth = spanWrapper.outerWidth() + 10 spanWrapper.css('width', newWidth); } else if (!headline.hasClass('type')) { //assign to .word-rotator-words the width of its longest word var words = headline.find('.word-rotator-words b'), width = 0; words.each(function() { var wordWidth = $(this).outerWidth(); if (wordWidth > width) width = wordWidth; }); headline.find('.word-rotator-words').css('width', width); }; // Trigger animation setTimeout(function() { hideWord(headline.find('.is-visible').eq(0)) }, duration); }, {}); } function hideWord($word) { var nextWord = takeNext($word); if ($word.parents('.word-rotator').hasClass('type')) { var parentSpan = $word.parent('.word-rotator-words'); parentSpan.addClass('selected').removeClass('waiting'); setTimeout(function() { parentSpan.removeClass('selected'); $word.removeClass('is-visible').addClass('is-hidden').children('i').removeClass('in').addClass('out'); }, selectionDuration); setTimeout(function() { showWord(nextWord, typeLettersDelay) }, typeAnimationDelay); } else if ($word.parents('.word-rotator').hasClass('letters')) { var bool = ($word.children('i').length >= nextWord.children('i').length) ? true : false; hideLetter($word.find('i').eq(0), $word, bool, lettersDelay); showLetter(nextWord.find('i').eq(0), nextWord, bool, lettersDelay); } else if ($word.parents('.word-rotator').hasClass('clip')) { $word.parents('.word-rotator-words').stop( true, true ).animate({ width: '2px' }, revealDuration, function() { switchWord($word, nextWord); showWord(nextWord); }); } else if ($word.parents('.word-rotator').hasClass('loading-bar')) { $word.parents('.word-rotator-words').removeClass('is-loading'); switchWord($word, nextWord); setTimeout(function() { hideWord(nextWord) }, barAnimationDelay); setTimeout(function() { $word.parents('.word-rotator-words').addClass('is-loading') }, barWaiting); } else { switchWord($word, nextWord); setTimeout(function() { hideWord(nextWord) }, animationDelay); } } function showWord($word, $duration) { if ($word.parents('.word-rotator').hasClass('type')) { showLetter($word.find('i').eq(0), $word, false, $duration); $word.addClass('is-visible').removeClass('is-hidden'); } else if ($word.parents('.word-rotator').hasClass('clip')) { if (document.hasFocus()) { $word.parents('.word-rotator-words').stop( true, true ).animate({ 'width': $word.outerWidth() + 10 }, revealDuration, function() { setTimeout(function() { hideWord($word) }, revealAnimationDelay); }); } else { $word.parents('.word-rotator-words').stop( true, true ).animate({ width: $word.outerWidth() + 10 }); setTimeout(function() { hideWord($word) }, revealAnimationDelay); } } } function hideLetter($letter, $word, $bool, $duration) { $letter.removeClass('in').addClass('out'); if (!$letter.is(':last-child')) { setTimeout(function() { hideLetter($letter.next(), $word, $bool, $duration); }, $duration); } else if ($bool) { setTimeout(function() { hideWord(takeNext($word)) }, animationDelay); } if ($letter.is(':last-child') && $('html').hasClass('no-csstransitions')) { var nextWord = takeNext($word); switchWord($word, nextWord); } } function showLetter($letter, $word, $bool, $duration) { $letter.addClass('in').removeClass('out'); if (!$letter.is(':last-child')) { setTimeout(function() { showLetter($letter.next(), $word, $bool, $duration); }, $duration); } else { if ($word.parents('.word-rotator').hasClass('type')) { setTimeout(function() { $word.parents('.word-rotator-words').addClass('waiting'); }, 200); } if (!$bool) { setTimeout(function() { hideWord($word) }, animationDelay) } if (!$word.closest('.word-rotator').hasClass('type')) { $word.closest('.word-rotator-words').stop( true, true ).animate({ width: $word.outerWidth() }); } } } function takeNext($word) { return (!$word.is(':last-child')) ? $word.next() : $word.parent().children().eq(0); } function takePrev($word) { return (!$word.is(':first-child')) ? $word.prev() : $word.parent().children().last(); } function switchWord($oldWord, $newWord) { $oldWord.removeClass('is-visible').addClass('is-hidden'); $newWord.removeClass('is-hidden').addClass('is-visible'); if (!$newWord.closest('.word-rotator').hasClass('clip')) { var space = 0, delay = ($newWord.outerWidth() > $oldWord.outerWidth()) ? 0 : 600; if ($newWord.closest('.word-rotator').hasClass('loading-bar') || $newWord.closest('.word-rotator').hasClass('slide')) { space = 3; delay = 0; } setTimeout(function() { $newWord.closest('.word-rotator-words').stop( true, true ).animate({ width: $newWord.outerWidth() + space }); }, delay); } } }); /* jQuery Hover3d ================================================= Version: 1.1.0 Author: Rian Ariona Website: http://ariona.net Docs: http://ariona.github.io/hover3d Repo: http://github.com/ariona/hover3d Issues: http://github.com/ariona/hover3d/issues */ (function($){ $.fn.hover3d = function(options){ var settings = $.extend({ selector : null, perspective : 1000, sensitivity : 20, invert : false, shine : false, hoverInClass : "hover-in", hoverOutClass : "hover-out", hoverClass : "hover-3d" }, options); return this.each(function(){ var $this = $(this), $card = $this.find(settings.selector); currentX = 0; currentY = 0; if( settings.shine ){ $card.append('
'); } var $shine = $(this).find(".shine"); // Set perspective and transformStyle value // for element and 3d object $this.css({ perspective: settings.perspective+"px", transformStyle: "preserve-3d" }); $card.css({ perspective: settings.perspective+"px", transformStyle: "preserve-3d", }); $shine.css({ position : "absolute", top : 0, left : 0, bottom : 0, right : 0, transform : 'translateZ(1px)', "z-index" : 9 }); // Mouse Enter function, this will add hover-in // Class so when mouse over it will add transition // based on hover-in class function enter(event){ $card.addClass(settings.hoverInClass+" "+settings.hoverClass); currentX = currentY = 0; setTimeout(function(){ $card.removeClass(settings.hoverInClass); }, 1000); } // Mouse movement Parallax effect function move(event){ var w = $card.innerWidth(), h = $card.innerHeight(), currentX = Math.round(event.pageX - $card.offset().left), currentY = Math.round(event.pageY - $card.offset().top), ax = settings.invert ? ( w / 2 - currentX)/settings.sensitivity : -( w / 2 - currentX)/settings.sensitivity, ay = settings.invert ? -( h / 2 - currentY)/settings.sensitivity : ( h / 2 - currentY)/settings.sensitivity, dx = currentX - w / 2, dy = currentY - h / 2, theta = Math.atan2(dy, dx), angle = theta * 180 / Math.PI - 90; if (angle < 0) { angle = angle + 360; } $card.css({ perspective : settings.perspective+"px", transformStyle : "preserve-3d", transform : "rotateY("+ax+"deg) rotateX("+ay+"deg)" }); $shine.css('background', 'linear-gradient(' + angle + 'deg, rgba(255,255,255,' + event.offsetY / h * .5 + ') 0%,rgba(255,255,255,0) 80%)'); } // Mouse leave function, will set the transform // property to 0, and add transition class // for exit animation function leave(){ $card.addClass(settings.hoverOutClass+" "+settings.hoverClass); $card.css({ perspective : settings.perspective+"px", transformStyle : "preserve-3d", transform : "rotateX(0) rotateY(0)" }); setTimeout( function(){ $card.removeClass(settings.hoverOutClass+" "+settings.hoverClass); currentX = currentY = 0; }, 1000 ); } // Mouseenter event binding $this.on( "mouseenter", function(){ return enter(); }); // Mousemove event binding $this.on( "mousemove", function(event){ return move(event); }); // Mouseleave event binding $this.on( "mouseleave", function(){ return leave(); }); }); }; }(jQuery)); /* jQuery Hover3d */ (function($) { if ($.isFunction($.fn['hover3d']) && $('.hover-effect-3d').length) { theme.fn.execOnceTroughEvent( '.hover-effect-3d', 'mouseover.trigger.hover3d', function(){ $(this).each(function() { var $this = $(this); $this.hover3d({ selector: ".thumb-info" }); }); }); } }).apply(this, [jQuery]); /* * Title Border */ if($('[data-title-border]').length) { var $pageHeaderTitleBorder = $(''), $pageHeaderTitle = $('[data-title-border]'), $window = $(window); $pageHeaderTitle.before($pageHeaderTitleBorder); var setPageHeaderTitleBorderWidth = function() { $pageHeaderTitleBorder.width($pageHeaderTitle.width()); } $window.afterResize(function(){ setPageHeaderTitleBorderWidth(); }); setPageHeaderTitleBorderWidth(); $pageHeaderTitleBorder.addClass('visible'); } /* * Footer Reveal */ (function($) { var $footerReveal = { $wrapper: $('.footer-reveal'), init: function() { var self = this; self.build(); self.events(); }, build: function() { var self = this, footer_height = self.$wrapper.outerHeight(true), window_height = ( $(window).height() - $('.header-body').height() ); if( footer_height > window_height ) { $('#footer').removeClass('footer-reveal'); $('body').css('margin-bottom', 0); } else { $('#footer').addClass('footer-reveal'); $('body').css('margin-bottom', footer_height); } }, events: function() { var self = this, $window = $(window); $window.on('load', function(){ $window.afterResize(function(){ self.build(); }); }); } } if( $('.footer-reveal').length ) { $footerReveal.init(); } })(jQuery); /* Re-Init Plugin */ if( $('[data-reinit-plugin]').length ) { $('[data-reinit-plugin]').on('click', function(e) { e.preventDefault(); var pluginInstance = $(this).data('reinit-plugin'), pluginFunction = $(this).data('reinit-plugin-function'), pluginElement = $(this).data('reinit-plugin-element'), pluginOptions = theme.fn.getOptions($(this).data('reinit-plugin-options')); $( pluginElement ).data( pluginInstance ).destroy(); setTimeout(function(){ theme.fn.execPluginFunction(pluginFunction, $( pluginElement ), pluginOptions); }, 1000); }); } /* Simple Copy To Clipboard */ if( $('[data-copy-to-clipboard]').length ) { theme.fn.intObs( '[data-copy-to-clipboard]', function(){ var $this = $(this); $this.wrap( '
' ); var $copyButton = $('COPY'); $this.parent().prepend( $copyButton ); $copyButton.on('click', function(e){ e.preventDefault(); var $btn = $(this), $temp = $('