1/** 2 * Porto theme's main JavaScript file 3 */ 4 5/* Alternatives for old browsers */ 6if ( !String.prototype.endsWith ) { 7 String.prototype.endsWith = function( search, this_len ) { 8 if ( this_len === undefined || this_len > this.length ) { 9 this_len = this.length; 10 } 11 return this.substring( this_len - search.length, this_len ) === search; 12 }; 13} 14if ( window.NodeList && !NodeList.prototype.forEach ) { 15 NodeList.prototype.forEach = Array.prototype.forEach; 16} 17if ( !String.prototype.trim ) { 18 String.prototype.trim = function() { 19 return this.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '' ); 20 }; 21} 22 23/* Smart Resize */ 24( function( $, sr ) { 25 'use strict'; 26 27 // debouncing function from John Hann 28 // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 29 var debounce = function( func, threshold, execAsap ) { 30 var timeout; 31 32 return function debounced() { 33 var obj = this, args = arguments; 34 function delayed() { 35 if ( !execAsap ) 36 func.apply( obj, args ); 37 timeout = null; 38 } 39 40 if ( timeout && timeout.val ) 41 theme.deleteTimeout( timeout ); 42 else if ( execAsap ) 43 func.apply( obj, args ); 44 45 timeout = theme.requestTimeout( delayed, threshold || 100 ); 46 }; 47 }; 48 // smartresize 49 jQuery.fn[sr] = function( fn ) { return fn ? this.on( 'resize', debounce( fn ) ) : this.trigger( sr ); }; 50 51} )( jQuery, 'smartresize' ); 52 53/* easing */ 54jQuery.extend( jQuery.easing, { 55 def: 'easeOutQuad', 56 swing: function( x, t, b, c, d ) { 57 return jQuery.easing[jQuery.easing.def]( x, t, b, c, d ); 58 }, 59 easeOutQuad: function( x, t, b, c, d ) { 60 return -c * ( t /= d ) * ( t - 2 ) + b; 61 }, 62 easeInOutQuart: function( x, t, b, c, d ) { 63 if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t * t * t + b; 64 return -c / 2 * ( ( t -= 2 ) * t * t * t - 2 ) + b; 65 }, 66 easeOutQuint: function( x, t, b, c, d ) { 67 return c * ( ( t = t / d - 1 ) * t * t * t * t + 1 ) + b; 68 } 69} ); 70 71( function( $ ) { 72 73 /** 74 * Copyright 2012, Digital Fusion 75 * Licensed under the MIT license. 76 * http://teamdf.com/jquery-plugins/license/ 77 * 78 * @author Sam Sehnert 79 * @desc A small plugin that checks whether elements are within 80 * the user visible viewport of a web browser. 81 * only accounts for vertical position, not horizontal. 82 */ 83 $.fn.visible = function( partial, hidden, direction, container ) { 84 85 if ( this.length < 1 ) 86 return; 87 88 var $t = this.length > 1 ? this.eq( 0 ) : this, 89 isContained = typeof container !== 'undefined' && container !== null, 90 $w = isContained ? $( container ) : $( window ), 91 wPosition = isContained ? $w.position() : 0, 92 t = $t.get( 0 ), 93 vpWidth = $w.outerWidth(), 94 vpHeight = $w.outerHeight(), 95 direction = ( direction ) ? direction : 'both', 96 clientSize = hidden === true ? t.offsetWidth * t.offsetHeight : true; 97 98 if ( typeof t.getBoundingClientRect === 'function' ) { 99 100 // Use this native browser method, if available. 101 var rec = t.getBoundingClientRect(), 102 tViz = isContained ? 103 rec.top - wPosition.top >= 0 && rec.top < vpHeight + wPosition.top : 104 rec.top >= 0 && rec.top < vpHeight, 105 bViz = isContained ? 106 rec.bottom - wPosition.top > 0 && rec.bottom <= vpHeight + wPosition.top : 107 rec.bottom > 0 && rec.bottom <= vpHeight, 108 lViz = isContained ? 109 rec.left - wPosition.left >= 0 && rec.left < vpWidth + wPosition.left : 110 rec.left >= 0 && rec.left < vpWidth, 111 rViz = isContained ? 112 rec.right - wPosition.left > 0 && rec.right < vpWidth + wPosition.left : 113 rec.right > 0 && rec.right <= vpWidth, 114 vVisible = partial ? tViz || bViz : tViz && bViz, 115 hVisible = partial ? lViz || rViz : lViz && rViz; 116 117 if ( direction === 'both' ) 118 return clientSize && vVisible && hVisible; 119 else if ( direction === 'vertical' ) 120 return clientSize && vVisible; 121 else if ( direction === 'horizontal' ) 122 return clientSize && hVisible; 123 } else { 124 125 var viewTop = isContained ? 0 : wPosition, 126 viewBottom = viewTop + vpHeight, 127 viewLeft = $w.scrollLeft(), 128 viewRight = viewLeft + vpWidth, 129 position = $t.position(), 130 _top = position.top, 131 _bottom = _top + $t.height(), 132 _left = position.left, 133 _right = _left + $t.width(), 134 compareTop = partial === true ? _bottom : _top, 135 compareBottom = partial === true ? _top : _bottom, 136 compareLeft = partial === true ? _right : _left, 137 compareRight = partial === true ? _left : _right; 138 139 if ( direction === 'both' ) 140 return !!clientSize && ( ( compareBottom <= viewBottom ) && ( compareTop >= viewTop ) ) && ( ( compareRight <= viewRight ) && ( compareLeft >= viewLeft ) ); 141 else if ( direction === 'vertical' ) 142 return !!clientSize && ( ( compareBottom <= viewBottom ) && ( compareTop >= viewTop ) ); 143 else if ( direction === 'horizontal' ) 144 return !!clientSize && ( ( compareRight <= viewRight ) && ( compareLeft >= viewLeft ) ); 145 } 146 }; 147 148} )( jQuery ); 149 150/* 151 Name: Porto Theme Javascript 152 Writtern By: P-THEMES 153 Javascript Version: 1.2 154 */ 155 156// Theme 157window.theme = {}; 158 159// Configuration 160( function( theme, $ ) { 161 'use strict'; 162 163 theme = theme || {}; 164 165 $.extend( theme, { 166 167 rtl: js_porto_vars.rtl == '1' ? true : false, 168 rtl_browser: $( 'html' ).hasClass( 'browser-rtl' ), 169 170 ajax_url: js_porto_vars.ajax_url, 171 request_error: js_porto_vars.request_error, 172 173 change_logo: js_porto_vars.change_logo == '1' ? true : false, 174 175 show_sticky_header: js_porto_vars.show_sticky_header == '1' ? true : false, 176 show_sticky_header_tablet: js_porto_vars.show_sticky_header_tablet == '1' ? true : false, 177 show_sticky_header_mobile: js_porto_vars.show_sticky_header_mobile == '1' ? true : false, 178 179 category_ajax: js_porto_vars.category_ajax == '1' ? true : false, 180 prdctfltr_ajax: js_porto_vars.prdctfltr_ajax == '1' ? true : false, 181 182 container_width: parseInt( js_porto_vars.container_width ), 183 grid_gutter_width: parseInt( js_porto_vars.grid_gutter_width ), 184 screen_xl: parseInt( js_porto_vars.screen_xl ), 185 screen_xxl: parseInt( js_porto_vars.screen_xxl ), 186 slider_loop: js_porto_vars.slider_loop == '1' ? true : false, 187 slider_autoplay: js_porto_vars.slider_autoplay == '1' ? true : false, 188 slider_autoheight: js_porto_vars.slider_autoheight == '1' ? true : false, 189 slider_speed: js_porto_vars.slider_speed ? js_porto_vars.slider_speed : 5000, 190 slider_nav: js_porto_vars.slider_nav == '1' ? true : false, 191 slider_nav_hover: js_porto_vars.slider_nav_hover == '1' ? true : false, 192 slider_margin: js_porto_vars.slider_margin == '1' ? 40 : 0, 193 slider_dots: js_porto_vars.slider_dots == '1' ? true : false, 194 slider_animatein: js_porto_vars.slider_animatein ? js_porto_vars.slider_animatein : '', 195 slider_animateout: js_porto_vars.slider_animateout ? js_porto_vars.slider_animateout : '', 196 product_thumbs_count: js_porto_vars.product_thumbs_count ? parseInt( js_porto_vars.product_thumbs_count, 10 ) : 4, 197 product_zoom: js_porto_vars.product_zoom == '1' ? true : false, 198 product_zoom_mobile: js_porto_vars.product_zoom_mobile == '1' ? true : false, 199 product_image_popup: js_porto_vars.product_image_popup == '1' ? 'fadeOut' : false, 200 innerHeight: window.innerHeight, 201 animation_support: !$( 'html' ).hasClass( 'no-csstransitions' ) && window.innerWidth > 767, 202 203 owlConfig: { 204 rtl: js_porto_vars.rtl == '1' ? true : false, 205 loop: js_porto_vars.slider_loop == '1' ? true : false, 206 autoplay: js_porto_vars.slider_autoplay == '1' ? true : false, 207 autoHeight: js_porto_vars.slider_autoheight == '1' ? true : false, 208 autoplayTimeout: js_porto_vars.slider_speed ? js_porto_vars.slider_speed : 7000, 209 autoplayHoverPause: true, 210 lazyLoad: true, 211 nav: js_porto_vars.slider_nav == '1' ? true : false, 212 navText: ["", ""], 213 dots: js_porto_vars.slider_dots == '1' ? true : false, 214 stagePadding: ( js_porto_vars.slider_nav_hover != '1' && js_porto_vars.slider_margin == '1' ) ? 40 : 0, 215 animateOut: js_porto_vars.slider_animateout ? js_porto_vars.slider_animateout : '', 216 animateIn: js_porto_vars.slider_animatein ? js_porto_vars.slider_animatein : '' 217 }, 218 219 sticky_nav_height: 0, 220 221 is_device_mobile: /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test( navigator.userAgent || navigator.vendor || window.opera ) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
221sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( ( navigator.userAgent || navigator.vendor || window.opera ).substr( 0, 4 ) ), 222 223 getScrollbarWidth: function() { 224 225 if ( this.scrollbarSize === undefined ) { 226 this.scrollbarSize = window.innerWidth - document.documentElement.clientWidth; 227 } 228 return this.scrollbarSize; 229 }, 230 231 isTablet: function() { 232 if ( window.innerWidth < 992 ) 233 return true; 234 return false; 235 }, 236 237 isMobile: function() { 238 if ( window.innerWidth <= 480 ) 239 return true; 240 return false; 241 }, 242 243 isIOS: function () { 244 return [ 245 'iPad Simulator', 246 'iPhone Simulator', 247 'iPod Simulator', 248 'iPad', 249 'iPhone', 250 'iPod' 251 ].includes(navigator.platform) 252 // iPad on iOS 13 detection 253 || (navigator.userAgent.includes("Mac") && "ontouchend" in document); 254 }, 255 256 refreshVCContent: function( $elements ) { 257 if ( $elements || $( document.body ).hasClass( 'elementor-page' ) ) { 258 $( window ).trigger( 'resize' ); 259 } 260 theme.refreshStickySidebar( true ); 261 262 if ( typeof window.vc_js == 'function' ) 263 window.vc_js(); 264 265 $( document.body ).trigger( 'porto_refresh_vc_content', [$elements] ); 266 }, 267 268 adminBarHeight: function() { 269 if ( theme.adminBarHeightNum || 0 === theme.adminBarHeightNum ) { 270 return theme.adminBarHeightNum; 271 } 272 var obj = document.getElementById( 'wpadminbar' ), 273 fixed_top = $( '.porto-scroll-progress.fixed-top:not(.fixed-under-header)' ); 274 if ( fixed_top.length && '0px' == fixed_top.css( 'margin-top' ) ) { 275 theme.adminBarHeightNum = fixed_top.height(); 276 } else { 277 theme.adminBarHeightNum = 0; 278 } 279 if ( obj && obj.offsetHeight && window.innerWidth > 600 ) { 280 theme.adminBarHeightNum += obj.offsetHeight; 281 } 282 283 return theme.adminBarHeightNum; 284 }, 285 286 refreshStickySidebar: function( timeout, $sticky_sidebar ) { 287 if ( typeof $sticky_sidebar == 'undefined' ) { 288 $sticky_sidebar = $( '.sidebar [data-plugin-sticky]' ); 289 } 290 if ( $sticky_sidebar.get( 0 ) ) { 291 if ( timeout ) { 292 theme.requestTimeout( function() { 293 $sticky_sidebar.trigger( 'recalc.pin' ); 294 }, 400 ); 295 } else { 296 $sticky_sidebar.trigger( 'recalc.pin' ); 297 } 298 } 299 }, 300 301 scrolltoContainer: function( $container, timeout ) { 302 if ( $container.get( 0 ) ) { 303 if ( window.innerWidth < 992 ) { 304 $( '.sidebar-overlay' ).trigger( 'click' ); 305 } 306 if ( !timeout ) { 307 timeout = 600; 308 } 309 $( 'html, body' ).stop().animate( { 310 scrollTop: $container.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height - 18 311 }, timeout, 'easeOutQuad' ); 312 } 313 }, 314 315 requestFrame: function( fn ) { 316 var handler = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; 317 if ( !handler ) { 318 return setTimeout( fn, 1000 / 60 ); 319 } 320 var rt = new Object() 321 rt.val = handler( fn ); 322 return rt; 323 }, 324 325 requestTimeout: function( fn, delay ) { 326 var handler = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; 327 if ( !handler ) { 328 return setTimeout( fn, delay ); 329 } 330 var start, rt = new Object(); 331 332 function loop( timestamp ) { 333 if ( !start ) { 334 start = timestamp; 335 } 336 var progress = timestamp - start; 337 progress >= delay ? fn.call() : rt.val = handler( loop ); 338 }; 339 340 rt.val = handler( loop ); 341 return rt; 342 }, 343 344 deleteTimeout: function( timeoutID ) { 345 if ( !timeoutID ) { 346 return; 347 } 348 var handler = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame; 349 if ( !handler ) { 350 return clearTimeout( timeoutID ); 351 } 352 if ( timeoutID.val ) { 353 return handler( timeoutID.val ); 354 } 355 }, 356 357 execPluginFunction: function( functionName, context ) { 358 var args = Array.prototype.slice.call( arguments, 2 ); 359 var namespaces = functionName.split( "." ); 360 var func = namespaces.pop(); 361 362 for ( var i = 0; i < namespaces.length; i++ ) { 363 context = context[namespaces[i]]; 364 } 365 366 return context[func].apply( context, args ); 367 }, 368 369 getOptions: function( opts ) { 370 if ( typeof ( opts ) == 'object' ) { 371 return opts; 372 } else if ( typeof ( opts ) == 'string' ) { 373 try { 374 return JSON.parse( opts.replace( /'/g, '"' ).replace( ';', '' ) ); 375 } catch ( e ) { 376 return {}; 377 } 378 } else { 379 return {}; 380 } 381 }, 382 mergeOptions: function( obj1, obj2 ) { 383 var obj3 = {}; 384 for ( var attrname in obj1 ) { obj3[attrname] = obj1[attrname]; } 385 for ( var attrname in obj2 ) { obj3[attrname] = obj2[attrname]; } 386 return obj3; 387 }, 388 389 intObs: function( selector, functionName, accY ) { 390 var $el; 391 if ( typeof selector == 'string' ) { 392 $el = document.querySelectorAll( selector ); 393 } else { 394 $el = selector; 395 } 396 var intersectionObserverOptions = { 397 rootMargin: '200px' 398 } 399 if ( typeof accY != 'undefined' ) { 400 intersectionObserverOptions.rootMargin = '0px 0px ' + Number( accY ) + 'px 0px'; 401 } 402 403 var observer = new IntersectionObserver( function( entries ) { 404 for ( var i = 0; i < entries.length; i++ ) { 405 var entry = entries[i];
406 if ( entry.intersectionRatio > 0 ) { 407 var $this = $( entry.target ), 408 opts; 409 410 if ( typeof functionName == 'string' ) { 411 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 412 if ( pluginOptions ) 413 opts = pluginOptions; 414 415 theme.execPluginFunction( functionName, $this, opts ); 416 } else { 417 var callback = functionName; 418 callback.call( $this ); 419 } 420 421 // Unobserve 422 observer.unobserve( entry.target ); 423 } 424 } 425 }, intersectionObserverOptions ); 426 427 Array.prototype.forEach.call( $el, function( obj ) { 428 observer.observe( obj ); 429 } ); 430 }, 431 432 dynIntObsInit: function( selector, functionName, pluginDefaults ) { 433 var $el; 434 if ( typeof selector == 'string' ) { 435 $el = document.querySelectorAll( selector ); 436 } else { 437 $el = selector; 438 } 439 440 Array.prototype.forEach.call( $el, function( obj ) { 441 var $this = $( obj ), 442 opts; 443 if ( $this.data( 'observer-init' ) ) { 444 return; 445 } 446 447 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 448 if ( pluginOptions ) 449 opts = pluginOptions; 450 451 var mergedPluginDefaults = theme.mergeOptions( pluginDefaults, opts ) 452 453 var intersectionObserverOptions = { 454 rootMargin: '0px 0px 200px 0px', 455 thresholds: 0 456 } 457 if ( mergedPluginDefaults.accY ) { 458 intersectionObserverOptions.rootMargin = '0px 0px ' + Number( mergedPluginDefaults.accY ) + 'px 0px'; 459 } 460 461 var observer = new IntersectionObserver( function( entries ) { 462 for ( var i = 0; i < entries.length; i++ ) { 463 var entry = entries[i]; 464 if ( entry.intersectionRatio > 0 ) { 465 theme.execPluginFunction( functionName, $this, mergedPluginDefaults ); 466 467 // Unobserve 468 observer.unobserve( entry.target ); 469 } 470 } 471 }, intersectionObserverOptions ); 472 473 observer.observe( obj ); 474 $this.data( 'observer-init', true ); 475 } ); 476 } 477 478 } ); 479 480 if ( theme.isIOS() ) { 481 document.body.classList.add( 'ios' ); 482 } 483 484} ).apply( this, [window.theme, jQuery] ); 485 486/** 487 * Copyright 2016 Google Inc. All Rights Reserved. 488 * 489 * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE. 490 * 491 * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document 492 * 493 */ 494!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 < t.length; e++ )t[e]() }, s.prototype._checkForIntersections = function() { if ( this.root || !o || n ) { var t = this._rootIsInDom(), e = t ? this._getRootRect() : { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
vendor: 5,402 bytes, line 494
494 this._observationTargets.forEach( function( n ) { var i = n.element, s = u( i ), h = this._rootContainsTarget( i ), c = n.entry, a = t && h && this._computeTargetAndRootIntersection( i, s, e ), l = null; this._rootContainsTarget( i ) ? o && !this.root || ( l = e ) : l = { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 }; var f = n.entry = new r( { time: window.performance && performance.now && performance.now(), target: i, boundingClientRect: s, rootBounds: l, intersectionRect: a } ); c ? t && h ? this._hasCrossedThreshold( c, f ) && this._queuedEntries.push( f ) : c && c.isIntersecting && this._queuedEntries.push( f ) : this._queuedEntries.push( f ) }, this ), this._queuedEntries.length && this._callback( this.takeRecords(), this ) } }, s.prototype._computeTargetAndRootIntersection = function( e, i, r ) { if ( "none" != window.getComputedStyle( e ).display ) { for ( var s, h, c, a, f, d, g, m, v = i, _ = p( e ), b = !1; !b && _; ) { var w = null, y = 1 == _.nodeType ? window.getComputedStyle( _ ) : {}; if ( "none" == y.display ) return null; if ( _ == this.root || 9 == _.nodeType ) if ( b = !0, _ == this.root || _ == t ) o && !this.root ? !n || 0 == n.width && 0 == n.height ? ( _ = null, w = null, v = null ) : w = n : w = r; else { var I = p( _ ), E = I && u( I ), T = I && this._computeTargetAndRootIntersection( I, E, r ); E && T ? ( _ = I, w = l( E, T ) ) : ( _ = null, v = null ) } else { var R = _.ownerDocument; _ != R.body && _ != R.documentElement && "visible" != y.overflow && ( w = u( _ ) ) } if ( w && ( s = w, h = v, c = void 0, a = void 0, f = void 0, d = void 0, g = void 0, m = void 0, c = Math.max( s.top, h.top ), a = Math.min( s.bottom, h.bottom ), f = Math.max( s.left, h.left ), d = Math.min( s.right, h.right ), m = a - c, v = ( g = d - f ) >= 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 < this.thresholds.length; i++ ) { var r = this.thresholds[i]; if ( r == o || r == n || r < o != r < n ) return !0 } }, s.prototype._rootIsInDom = function() { return !this.root || f( t, this.root ) }, s.prototype._rootContainsTarget = function( e ) { var o = this.root && ( this.root.ownerDocument || this.root ) || t; return f( o, e ) && ( !this.root || o == e.ownerDocument ) }, s.prototype._registerInstance = function() { e.indexOf( this ) < 0 && e.push( this ) }, s.prototype._unregisterInstance = function() { var t = e.indexOf( this ); -1 != t && e.splice( t, 1 ) }, window.IntersectionObserver = s, window.IntersectionObserverEntry = r } function i( t ) { try { return t.defaultView && t.defaultView.frameElement || null } catch ( t ) { return null } } function r( t ) { this.time = t.time, this.target = t.target, this.rootBounds = a( t.rootBounds ), this.boundingClientRect = a( t.boundingClientRect ), this.intersectionRect = a( t.intersectionRect || { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 } ), this.isIntersecting = !!t.intersectionRect; var e = this.boundingClientRect, o = e.width * e.height, n = this.intersectionRect, i = n.width * n.height; this.intersectionRatio = o ? Number( ( i / o ).toFixed( 4 ) ) : this.isIntersecting ? 1 : 0 } function s( t, e ) { var o, n, i, r = e || {}; if ( "function" != typeof t ) throw new Error( "callback must be a function" ); if ( r.root && 1 != r.root.nodeType && 9 != r.root.nodeType ) throw new Error( "root must be a Document or Element" ); this._checkForIntersections = ( o = this._checkForIntersections.bind( this ), n = this.THROTTLE_TIMEOUT, i = null, function() { i || ( i = setTimeout( function() { o(), i = null }, n ) ) } ), this._callback = t, this._observationTargets = [], this._queuedEntries = [], this._rootMarginValues = this._parseRootMargin( r.rootMargin ), this.thresholds = this._initThresholds( r.threshold ), this.root = r.root || null, this.rootMargin = this._rootMarginValues.map( function( t ) { return t.value + t.unit } ).join( " " ), this._monitoringDocuments = [], this._monitoringUnsubscribes = [] } function h( t, e, o, n ) { "function" == typeof t.addEventListener ? t.addEventListener( e, o, n || !1 ) : "function" == typeof t.attachEvent && t.attachEvent( "on" + e, o ) } function c( t, e, o, n ) { "function" == typeof t.removeEventListener ? t.removeEventListener( e, o, n || !1 ) : "function" == typeof t.detatchEvent && t.detatchEvent( "on" + e, o ) } function u( t ) { var e;
494 try { e = t.getBoundingClientRect() } catch ( t ) { } return e ? ( e.width && e.height || ( e = { top: e.top, right: e.right, bottom: e.bottom, left: e.left, width: e.right - e.left, height: e.bottom - e.top } ), e ) : { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 } } function a( t ) { return !t || "x" in t ? t : { top: t.top, y: t.top, bottom: t.bottom, left: t.left, x: t.left, right: t.right, width: t.width, height: t.height } } function l( t, e ) { var o = e.top - t.top, n = e.left - t.left; return { top: o, left: n, height: e.height, width: e.width, bottom: o + e.height, right: n + e.width } } function f( t, e ) { for ( var o = e; o; ) { if ( o == t ) return !0; o = p( o ) } return !1 } function p( e ) { var o = e.parentNode; return 9 == e.nodeType && e != t ? i( e ) : ( o && o.assignedSlot && ( o = o.assignedSlot.parentNode ), o && 11 == o.nodeType && o.host ? o.host : o ) } function d( t ) { return t && 9 === t.nodeType } }(); 495 496/* browser select */ 497( function( $ ) { 498 'use strict'; 499 $.extend( { 500 501 browserSelector: function() { 502 503 // Touch 504 var hasTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; 505 506 var u = navigator.userAgent, 507 ua = u.toLowerCase(), 508 is = function( t ) { 509 return ua.indexOf( t ) > -1; 510 }, 511 g = 'gecko', 512 w = 'webkit', 513 s = 'safari', 514 o = 'opera', 515 h = document.documentElement, 516 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']; 517 518 var c = b.join( ' ' ); 519 520 if ( theme.is_device_mobile ) { 521 c += ' mobile'; 522 } 523 524 if ( hasTouch ) { 525 c += ' touch'; 526 } 527 528 h.className += ' ' + c; 529 530 // IE11 Detect 531 var isIE11 = !( window.ActiveXObject ) && "ActiveXObject" in window; 532 533 if ( isIE11 ) { 534 $( 'html' ).removeClass( 'gecko' ).addClass( 'ie ie11' ); 535 return; 536 } 537 } 538 539 } ); 540 541 $.browserSelector(); 542 543} )( jQuery ); 544 545// Accordion 546( function( theme, $ ) { 547 'use strict'; 548 549 theme = theme || {}; 550 var instanceName = '__accordion'; 551 var Accordion = function( $el, opts ) { 552 return this.initialize( $el, opts ); 553 }; 554 Accordion.defaults = { 555 }; 556 Accordion.prototype = { 557 initialize: function( $el, opts ) { 558 if ( $el.data( instanceName ) ) { 559 return this; 560 } 561 562 this.$el = $el; 563 564 this 565 .setData() 566 .setOptions( opts ) 567 .build(); 568 569 return this; 570 }, 571 572 setData: function() { 573 this.$el.data( instanceName, this ); 574 return this; 575 }, 576 577 setOptions: function( opts ) { 578 this.options = $.extend( true, {}, Accordion.defaults, opts, { 579 wrapper: this.$el 580 } ); 581 582 return this; 583 }, 584 585 build: function() { 586 if ( !$.fn.collapse ) { 587 return this; 588 } 589 590 var $el = this.options.wrapper, 591 $collapse = $el.find( '.collapse' ), 592 collapsible = $el.data( 'collapsible' ), 593 active_num = $el.data( 'active-tab' ); 594 595 if ( $collapse.length > 0 ) { 596 if ( $el.data( 'use-accordion' ) && 'yes' == $el.data( 'use-accordion' ) ) { 597 $el.find( '.collapse' ).attr( 'data-parent', '#' + $el.attr( 'id' ) ); 598 } 599 if ( collapsible == 'yes' ) { 600 $collapse.collapse( { toggle: false, parent: '#' + $el.attr( 'id' ) } ); 601 } else if ( !isNaN( active_num ) && active_num == parseInt( active_num ) && $el.find( '.collapse' ).length > active_num ) { 602 $el.find( '.collapse' ).collapse( { toggle: false, parent: '#' + $el.attr( 'id' ) } ); 603 $el.find( '.collapse' ).eq( active_num - 1 ).collapse( 'toggle' ); 604 } else { 605 $el.find( '.collapse' ).collapse( { parent: '#' + $el.attr( 'id' ) } ); 606 } 607 } 608 609 return this; 610 } 611 }; 612 613 // expose to scope 614 $.extend( theme, { 615 Accordion: Accordion 616 } ); 617 618 // jquery plugin 619 $.fn.themeAccordion = function( opts ) { 620 return this.map( function() { 621 var $this = $( this ); 622 623 if ( $this.data( instanceName ) ) { 624 return $this.data( instanceName ); 625 } else { 626 return new theme.Accordion( $this, opts ); 627 } 628 629 } ); 630 }; 631 632} ).apply( this, [window.theme, jQuery] ); 633 634 635// Accordion Menu 636( function( theme, $ ) { 637 638 'use strict'; 639 640 theme = theme || {}; 641 642 var instanceName = '__accordionMenu'; 643 644 var AccordionMenu = function( $el, opts ) { 645 return this.initialize( $el, opts ); 646 }; 647 648 AccordionMenu.defaults = { 649 650 }; 651 652 AccordionMenu.prototype = { 653 initialize: function( $el, opts ) { 654 if ( $el.data( instanceName ) ) { 655 return this; 656 } 657 658 this.$el = $el; 659 660 this 661 .setData() 662 .setOptions( opts ) 663 .build(); 664 665 return this; 666 }, 667 668 setData: function() { 669 this.$el.data( instanceName, this ); 670 671 return this; 672 }, 673 674 setOptions: function( opts ) { 675 this.options = $.extend( true, {}, AccordionMenu.defaults, opts, { 676 wrapper: this.$el 677 } ); 678 679 return this; 680 }, 681 682 build: function() { 683 var self = this, 684 $el = this.options.wrapper; 685 686 $el.find( 'li.menu-item.active' ).each( function() { 687 var $this = $( this ); 688 689 if ( $this.find( '> .arrow' ).get( 0 ) ) 690 $this.find( '> .arrow' ).trigger( 'click' ); 691 } ); 692 693 $el.on( 'click', '.arrow', function( e ) { 694 e.preventDefault(); 695 e.stopPropagation(); 696 var $this = $( this ), 697 $parent = $this.closest( 'li' ); 698 if ( typeof self.options.open_one != 'undefined' ) { 699 $parent.siblings( '.open' ).children( '.arrow' ).next().hide(); 700 $parent.siblings( '.open' ).removeClass( 'open' ); 701 $this.next().stop().toggle(); 702 } else { 703 $this.next().stop().slideToggle(); 704 } 705 if ( $parent.hasClass( 'open' ) ) { 706 $parent.removeClass( 'open' ); 707 } else { 708 $parent.addClass( 'open' ); 709 } 710 return false; 711 } ); 712 713 return this; 714 } 715 }; 716 717 // expose to scope 718 $.extend( theme, { 719 AccordionMenu: AccordionMenu 720 } ); 721 722 // jquery plugin 723 $.fn.themeAccordionMenu = function( opts ) { 724 return this.map( function() { 725 var $this = $( this ); 726 727 if ( $this.data( instanceName ) ) { 728 return $this.data( instanceName ); 729 } else { 730 return new theme.AccordionMenu( $this, opts ); 731 } 732 733 } ); 734 }; 735 736} ).apply( this, [window.theme, jQuery] ); 737 738// Fit Video 739( function( theme, $ ) { 740 'use strict'; 741 742 theme = theme || {}; 743 744 var instanceName = '__fitVideo'; 745 746 var FitVideo = function( $el, opts ) { 747 return this.initialize( $el, opts ); 748 }; 749 750 FitVideo.defaults = { 751 752 }; 753 754 FitVideo.prototype = { 755 initialize: function( $el, opts ) { 756 if ( $el.data( instanceName ) ) { 757 return this; 758 } 759 760 this.$el = $el; 761 762 this 763 .setData() 764 .setOptions( opts ) 765 .build(); 766 767 return this; 768 }, 769 770 setData: function() { 771 this.$el.data( instanceName, this ); 772 773 return this; 774 }, 775 776 setOptions: function( opts ) { 777 this.options = $.extend( true, {}, FitVideo.defaults, opts, { 778 wrapper: this.$el 779 } ); 780 781 return this; 782 }, 783 784 build: function() { 785 if ( !$.fn.fitVids ) { 786 return this; 787 } 788 789 var $el = this.options.wrapper; 790 791 $el.fitVids(); 792 $( window ).on( 'resize', function() { 793 $el.fitVids(); 794 } ); 795 796 return this; 797 } 798 }; 799 800 // expose to scope 801 $.extend( theme, { 802 FitVideo: FitVideo 803 } ); 804 805 // jquery plugin 806 $.fn.themeFitVideo = function( opts ) { 807 return this.map( function() { 808 var $this = $( this ); 809 810 if ( $this.data( instanceName ) ) { 811 return $this.data( instanceName ); 812 } else { 813 return new theme.FitVideo( $this, opts ); 814 } 815 816 } ); 817 }; 818 819} ).apply( this, [window.theme, jQuery] ); 820
821/* Porto Video Background */ 822( function( theme, $ ) { 823 'use strict'; 824 825 theme = theme || {}; 826 827 var instanceName = '__videobackground'; 828 829 var PluginVideoBackground = function( $el, opts ) { 830 return this.initialize( $el, opts ); 831 }; 832 833 PluginVideoBackground.defaults = { 834 overlay: true, 835 volume: 1, 836 playbackRate: 1, 837 muted: true, 838 loop: true, 839 autoplay: true, 840 position: '50% 50%', 841 posterType: 'detect' 842 }; 843 844 PluginVideoBackground.prototype = { 845 initialize: function( $el, opts ) { 846 this.$el = $el; 847 848 this 849 .setData() 850 .setOptions( opts ) 851 .build(); 852 853 return this; 854 }, 855 856 setData: function() { 857 this.$el.data( instanceName, this ); 858 859 return this; 860 }, 861 862 setOptions: function( opts ) { 863 this.options = $.extend( true, {}, PluginVideoBackground.defaults, opts, { 864 path: this.$el.data( 'video-path' ), 865 wrapper: this.$el 866 } ); 867 868 return this; 869 }, 870 871 build: function() { 872 873 if ( !$.fn.vide || !this.options.path ) { 874 return this; 875 } 876 877 if ( this.options.overlay ) { 878 this.options.wrapper.prepend( 879 $( '<div />' ).addClass( 'video-overlay' ) 880 ); 881 } 882 883 this.options.wrapper.vide( this.options.path, this.options ); 884 885 return this; 886 } 887 }; 888 889 // expose to scope 890 $.extend( theme, { 891 PluginVideoBackground: PluginVideoBackground 892 } ); 893 894 // jquery plugin 895 $.fn.themePluginVideoBackground = function( opts ) { 896 return this.map( function() { 897 var $this = $( this ); 898 899 if ( $this.data( instanceName ) ) { 900 return $this.data( instanceName ); 901 } else { 902 return new PluginVideoBackground( $this, opts ); 903 } 904 905 } ); 906 }; 907 908} ).apply( this, [window.theme, jQuery] ); 909 910// Flickr Zoom 911( function( theme, $ ) { 912 'use strict'; 913 914 theme = theme || {}; 915 916 var instanceName = '__flickrZoom'; 917 918 var FlickrZoom = function( $el, opts ) { 919 return this.initialize( $el, opts ); 920 }; 921 922 FlickrZoom.defaults = { 923 924 }; 925 926 FlickrZoom.prototype = { 927 initialize: function( $el, opts ) { 928 if ( $el.data( instanceName ) ) { 929 return this; 930 } 931 932 this.$el = $el; 933 934 this 935 .setData() 936 .setOptions( opts ) 937 .build(); 938 939 return this; 940 }, 941 942 setData: function() { 943 this.$el.data( instanceName, this ); 944 945 return this; 946 }, 947 948 setOptions: function( opts ) { 949 this.options = $.extend( true, {}, FlickrZoom.defaults, opts, { 950 wrapper: this.$el 951 } ); 952 953 return this; 954 }, 955 956 build: function() { 957 var $el = this.options.wrapper, 958 links = [], 959 i = 0, 960 $flickr_links = $el.find( '.flickr_badge_image > a' ); 961 962 $flickr_links.each( function() { 963 var slide = {}, 964 $image = $( this ).find( '> img' ); 965 966 slide.src = $image.attr( 'src' ).replace( '_s.', '_b.' ); 967 slide.title = $image.attr( 'title' ); 968 links[i] = slide; 969 i++; 970 } ); 971 972 $flickr_links.on( 'click', function( e ) { 973 e.preventDefault(); 974 if ( $.fn.magnificPopup ) { 975 $.magnificPopup.close(); 976 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 977 items: links, 978 gallery: { 979 enabled: true 980 }, 981 type: 'image' 982 } ), $flickr_links.index( $( this ) ) ); 983 } 984 } ); 985 986 return this; 987 } 988 }; 989 990 // expose to scope 991 $.extend( theme, { 992 FlickrZoom: FlickrZoom 993 } ); 994 995 // jquery plugin 996 $.fn.themeFlickrZoom = function( opts ) { 997 return this.map( function() { 998 var $this = $( this ); 999 1000 if ( $this.data( instanceName ) ) { 1001 return $this.data( instanceName ); 1002 } else { 1003 return new theme.FlickrZoom( $this, opts ); 1004 } 1005 1006 } ); 1007 } 1008 1009} ).apply( this, [window.theme, jQuery] ); 1010 1011// Lazy Load 1012( function( theme, $ ) { 1013 'use strict'; 1014 1015 theme = theme || {}; 1016 1017 var instanceName = '__lazyload'; 1018 1019 var PluginLazyLoad = function( $el, opts ) { 1020 return this.initialize( $el, opts ); 1021 }; 1022 1023 PluginLazyLoad.defaults = { 1024 effect: 'show', 1025 appearEffect: '', 1026 appear: function( elements_left, settings ) { 1027 1028 }, 1029 load: function( elements_left, settings ) { 1030 $( this ).addClass( 'lazy-load-loaded' ); 1031 } 1032 }; 1033 1034 PluginLazyLoad.prototype = { 1035 initialize: function( $el, opts ) { 1036 if ( !$el.length ) { 1037 return this; 1038 } 1039 1040 if ( !$.fn.lazyload ) { 1041 return this; 1042 } 1043 1044 var options = $.extend( true, {}, PluginLazyLoad.defaults, opts, {} ); 1045 return lazyload( $el, options ); 1046 } 1047 }; 1048 1049 // expose to scope 1050 $.extend( theme, { 1051 PluginLazyLoad: PluginLazyLoad 1052 } ); 1053 1054 // jquery plugin 1055 $.fn.themePluginLazyLoad = function( opts ) { 1056 var $this = $( this ); 1057 if ( $this.data( instanceName ) ) { 1058 return this; 1059 } else { 1060 var ins = new PluginLazyLoad( $.makeArray( this ), opts ); 1061 $this.data( instanceName, ins ); 1062 } 1063 return this; 1064 } 1065 1066} ).apply( this, [window.theme, jQuery] ); 1067 1068// Masonry 1069( function( theme, $ ) { 1070 'use strict'; 1071 1072 theme = theme || {}; 1073 1074 var instanceName = '__masonry'; 1075 1076 var Masonry = function( $el, opts ) { 1077 return this.initialize( $el, opts ); 1078 }; 1079 1080 Masonry.defaults = { 1081 itemSelector: 'li', 1082 isOriginLeft: !theme.rtl 1083 }; 1084 1085 Masonry.prototype = { 1086 initialize: function( $el, opts ) { 1087 if ( $el.data( instanceName ) ) { 1088 return this; 1089 } 1090 1091 this.$el = $el; 1092 1093 this 1094 .setData() 1095 .setOptions( opts ) 1096 .build(); 1097 1098 return this; 1099 }, 1100 1101 setData: function() { 1102 this.$el.data( instanceName, this ); 1103 1104 return this; 1105 }, 1106 1107 setOptions: function( opts ) { 1108 this.options = $.extend( true, {}, Masonry.defaults, opts, { 1109 wrapper: this.$el 1110 } ); 1111 1112 return this; 1113 }, 1114 1115 build: function() { 1116 if ( !$.fn.isotope ) { 1117 return this; 1118 } 1119 1120 var self = this, 1121 $el = this.options.wrapper, 1122 trigger_timer = null; 1123 $el.isotope( this.options ); 1124 $el.isotope( 'on', 'layoutComplete', function() { 1125 if ( typeof this.options.callback == 'function' ) { 1126 this.options.callback.call(); 1127 } 1128 1129 if ( $el.find( '.porto-lazyload:not(.lazy-load-loaded):visible' ).length ) { 1130 $( window ).trigger( 'scroll' ); 1131 } 1132 } ); 1133 $el.isotope( 'layout' ); 1134 self.resize(); 1135 $( window ).smartresize( function() { 1136 self.resize() 1137 } ); 1138 1139 return this; 1140 }, 1141 1142 resize: function() { 1143 var self = this, 1144 $el = this.options.wrapper; 1145 1146 if ( self.resizeTimer ) { 1147 theme.deleteTimeout( self.resizeTimer ); 1148 } 1149 1150 self.resizeTimer = theme.requestTimeout( function() { 1151 if ( $el.data( 'isotope' ) ) { 1152 $el.isotope( 'layout' ); 1153 } 1154 delete self.resizeTimer; 1155 }, 600 ); 1156 } 1157 }; 1158 1159 // expose to scope 1160 $.extend( theme, { 1161 Masonry: Masonry 1162 } ); 1163 1164 // jquery plugin 1165 $.fn.themeMasonry = function( opts ) { 1166 return this.map( function() { 1167 var $this = $( this ); 1168 imagesLoaded( this, function() { 1169 if ( $this.data( instanceName ) ) { 1170 return $this.data( instanceName ); 1171 } else { 1172 return new theme.Masonry( $this, opts ); 1173 } 1174 } ); 1175 1176 } ); 1177 } 1178 1179} ).apply( this, [window.theme, jQuery] ); 1180 1181 1182// Toggle 1183( function( theme, $ ) { 1184 'use strict'; 1185 1186 theme = theme || {}; 1187 1188 var instanceName = '__toggle'; 1189 1190 var Toggle = function( $el, opts ) { 1191 return this.initialize( $el, opts ); 1192 }; 1193 1194 Toggle.defaults = { 1195 1196 }; 1197 1198 Toggle.prototype = { 1199 initialize: function( $el, opts ) { 1200 if ( $el.data( instanceName ) ) { 1201 return this; 1202 } 1203 1204 this.$el = $el; 1205 1206 this 1207 .setData() 1208 .setOptions( opts ) 1209 .build(); 1210 1211 return this; 1212 }, 1213 1214 setData: function() { 1215 this.$el.data( instanceName, this ); 1216 1217 return this; 1218 }, 1219 1220 setOptions: function( opts ) { 1221 this.options = $.extend( true, {}, Toggle.defaults, opts, { 1222 wrapper: this.$el 1223 } ); 1224 1225 return this; 1226 }, 1227 1228 build: function() { 1229 var $el = this.options.wrapper; 1230 1231 if ( $el.hasClass( 'active' ) ) 1232 $el.find( "> div.toggle-content" ).stop().slideDown( 350, function() { 1233 $( this ).attr( 'style', '' ).show(); 1234 } ); 1235 1236 $el.on( 'click', "> label", function( e ) { 1237 var parentSection = $( this ).parent(), 1238 parentWrapper = $( this ).closest( "div.toogle" ), 1239 parentToggles = $( this ).closest( ".porto-toggles" ), 1240 isAccordion = parentWrapper.hasClass( "toogle-accordion" ), 1241 toggleContent = parentSection.find( "> div.toggle-content" ); 1242 1243 if ( isAccordion && typeof ( e.originalEvent ) != "undefined" ) { 1244 parentWrapper.find( "section.toggle.active > label" ).trigger( "click" ); 1245 } 1246 1247 // Preview Paragraph 1248 if ( !parentSection.hasClass( "active" ) ) { 1249 if ( parentToggles.length ) { 1250 if ( parentToggles.data( 'view' ) == 'one-toggle' ) { 1251 parentToggles.find( '.toggle' ).each( function() { 1252 $( this ).removeClass( 'active' ); 1253 $( this ).find( "> div.toggle-content" ).stop().slideUp( 350, function() { 1254 $( this ).attr( 'style', '' ).hide(); 1255 } ); 1256 } ); 1257 } 1258 } 1259 toggleContent.stop().slideDown( 350, function() { 1260 $( this ).attr( 'style', '' ).show(); 1261 theme.refreshVCContent( toggleContent ); 1262 } ); 1263 parentSection.addClass( "active" ); 1264 } else { 1265 if ( !parentToggles.length || parentToggles.data( 'view' ) != 'one-toggle' ) { 1266 toggleContent.stop().slideUp( 350, function() { 1267 $( this ).attr( 'style', '' ).hide(); 1268 } ); 1269 parentSection.removeClass( "active" ); 1270 } 1271 } 1272 } ); 1273 1274 return this; 1275 } 1276 }; 1277 1278 // expose to scope 1279 $.extend( theme, { 1280 Toggle: Toggle 1281 } ); 1282 1283 // jquery plugin 1284 $.fn.themeToggle = function( opts ) { 1285 return this.map( function() { 1286 var $this = $( this ); 1287 1288 if ( $this.data( instanceName ) ) { 1289 return $this.data( instanceName ); 1290 } else { 1291 return new theme.Toggle( $this, opts ); 1292 } 1293 1294 } ); 1295 } 1296 1297} ).apply( this, [window.theme, jQuery] ); 1298 1299// Parallax 1300( function( theme, $ ) { 1301 'use strict'; 1302 1303 theme = theme || {}; 1304 1305 var instanceName = '__parallax'; 1306 1307 var Parallax = function( $el, opts ) { 1308 return this.initialize( $el, opts ); 1309 }; 1310 1311 Parallax.defaults = { 1312 speed: 1.5, 1313 horizontalPosition: '50%', 1314 offset: 0, 1315 scale: false, 1316 startOffset: 7, 1317 scaleInvert: false, 1318 }; 1319 1320 Parallax.prototype = { 1321 initialize: function( $el, opts ) { 1322 if ( $el.data( instanceName ) ) { 1323 return this; 1324 } 1325 1326 this.$el = $el; 1327 1328 this 1329 .setData() 1330 .setOptions( opts ) 1331 .build(); 1332 1333 return this; 1334 }, 1335 1336 setData: function() { 1337 this.$el.data( instanceName, this ); 1338 1339 return this; 1340 }, 1341 1342 setOptions: function( opts ) { 1343 this.options = $.extend( true, {}, Parallax.defaults, opts, { 1344 wrapper: this.$el 1345 } ); 1346 1347 return this; 1348 }, 1349 1350 build: function() { 1351 var self = this, 1352 $window = $( window ), 1353 offset, 1354 yPos, 1355 bgpos, 1356 background; 1357 1358 // Create Parallax Element 1359 background = $( '<div class="parallax-background"></div>' ); 1360 1361 // Set Style for Parallax Element 1362 var bg = self.options.wrapper.data( 'image-src' ) ? 'url(' + self.options.wrapper.data( 'image-src' ) + ')' : self.options.wrapper.css( 'background-image' ); 1363 background.css( { 1364 'background-image': bg, 1365 'background-size': 'cover', 1366 'background-position': '50% 0%', 1367 'position': 'absolute', 1368 'top': 0, 1369 'left': 0, 1370 'width': '100%', 1371 'height': self.options.speed * 100 + '%' 1372 } ); 1373 1374 // Add Parallax Element on DOM 1375 self.options.wrapper.prepend( background ); 1376 1377 // Set Overlfow Hidden and Position Relative to Parallax Wrapper 1378 self.options.wrapper.css( { 1379 'position': 'relative', 1380 'overflow': 'hidden' 1381 } ); 1382
1383 if ( self.options.wrapper.attr( 'data-parallax-type' ) ) { // horizontal 1384 self.options.parallaxType = 'horizontal'; 1385 background.css( { 1386 'background-position': '0% 50%', 1387 'width': self.options.speed * 100 + '%', 1388 'height': '100%', 1389 } ); 1390 } 1391 1392 // Scroll Scale 1393 if ( self.options.scale ) { 1394 background.wrap( '<div class="parallax-scale-wrapper"></div>' ); 1395 background.css( { 1396 'transition': 'transform 500ms ease-out' 1397 } ); 1398 this.scaleParallaxFunc = this.scaleParallax.bind( this ); 1399 this.scaleParallaxFunc(); 1400 window.addEventListener( 'scroll', this.scaleParallaxFunc ); 1401 window.addEventListener( 'resize', this.scaleParallaxFunc ); 1402 } 1403 // Parallax Effect on Scroll & Resize 1404 var parallaxEffectOnScrolResize = function() { 1405 var skrollr_size = 100 * self.options.speed, 1406 skrollr_start = -( skrollr_size - 100 ); 1407 if ( !self.options.parallaxType ) { 1408 background.attr( "data-bottom-top", "top: " + skrollr_start + "%;" ).attr( "data-top-bottom", "top: 0%;" ); 1409 } else { 1410 skrollr_start /= 9.8; 1411 background.attr( "data-bottom-top", "left: " + skrollr_start + "%;" ).attr( "data-top-bottom", "left: 0%;" ); 1412 } 1413 } 1414 1415 if ( !theme.is_device_mobile ) { 1416 parallaxEffectOnScrolResize(); 1417 } else { 1418 if ( self.options.enableOnMobile == true ) { 1419 parallaxEffectOnScrolResize(); 1420 } else { 1421 self.options.wrapper.addClass( 'parallax-disabled' ); 1422 } 1423 } 1424 1425 return this; 1426 }, 1427 1428 scaleParallax: function() { 1429 var self = this, 1430 $window = $( window ), 1431 scrollTop = $window.scrollTop(), 1432 $background = self.options.wrapper.find( '.parallax-background' ), 1433 elementOffset = self.options.wrapper.offset().top, 1434 currentElementOffset = ( elementOffset - scrollTop ), 1435 scrollPercent = Math.abs( +( currentElementOffset - $window.height() ) / ( self.options.startOffset ? self.options.startOffset : 7 ) ); 1436 scrollPercent = parseInt( ( scrollPercent >= 100 ) ? 100 : scrollPercent ); 1437 var currentScale = ( scrollPercent / 100 ) * 50; 1438 if ( !self.options.scaleInvert ) { 1439 $background.css( { 1440 'transform': 'scale(1.' + String( currentScale ).padStart( 2, '0' ) + ', 1.' + String( currentScale ).padStart( 2, '0' ) + ')' 1441 } ); 1442 } else { 1443 $background.css( { 1444 'transform': 'scale(1.' + String( 50 - currentScale ).padStart( 2, '0' ) + ', 1.' + String( 50 - currentScale ).padStart( 2, '0' ) + ')' 1445 } ); 1446 } 1447 }, 1448 1449 disable: function() { 1450 var self = this; 1451 if ( self.options.scale ) { 1452 window.removeEventListener( 'scroll', this.scaleParallaxFunc ); 1453 window.removeEventListener( 'resize', this.scaleParallaxFunc ); 1454 } 1455 } 1456 }; 1457 1458 // expose to scope 1459 $.extend( theme, { 1460 Parallax: Parallax 1461 } ); 1462 1463 // jquery plugin 1464 $.fn.themeParallax = function( opts ) { 1465 if ( typeof skrollr == 'undefined' ) { 1466 return this; 1467 } 1468 var obj = this.map( function() { 1469 var $this = $( this ); 1470 1471 if ( $this.data( instanceName ) ) { 1472 return $this.data( instanceName ); 1473 } else { 1474 return new theme.Parallax( $this, opts ); 1475 } 1476 1477 } ); 1478 if ( theme.portoSkrollr ) { 1479 theme.portoSkrollr.refresh(); 1480 } else if ( !theme.is_device_mobile ) { 1481 theme.portoSkrollr = skrollr.init( { forceHeight: false, smoothScrolling: false, mobileCheck: function() { return theme.is_device_mobile } } ); 1482 } 1483 return obj; 1484 } 1485 1486} ).apply( this, [window.theme, jQuery] ); 1487 1488// In Viewport Style 1489!function( o, e ) { "object" == typeof exports && "undefined" != typeof module ? e( exports ) : "function" == typeof define && define.amd ? define( ["exports"], e ) : e( o.observeElementInViewport = {} ) }( this, function( o ) { function e( o, e, t, r ) { if ( void 0 === t && ( t = function() { } ), void 0 === r && ( r = {} ), !o ) throw new Error( "Target element to observe should be a valid DOM Node" ); var n = Object.assign( {}, { viewport: null, modTop: "0px", modRight: "0px", modBottom: "0px", modLeft: "0px", threshold: [0] }, r ), i = n.viewport, f = n.modTop, s = n.modLeft, u = n.modBottom, a = n.modRight, d = n.threshold; if ( !Array.isArray( d ) && "number" != typeof d ) throw new Error( "threshold should be a number or an array of numbers" ); var p = Array.isArray( d ) ? d.map( function( o ) { return Math.floor( o % 101 ) / 100 } ) : [Math.floor( d ? d % 101 : 0 ) / 100], c = Math.min.apply( Math, p ), m = { root: i instanceof Node ? i : null, rootMargin: f + " " + a + " " + u + " " + s, threshold: p }, h = new IntersectionObserver( function( r, n ) { var i = r.filter( function( e ) { return e.target === o } )[0], f = function() { return n.unobserve( o ) }; i && ( i.isInViewport = i.isIntersecting && i.intersectionRatio >= c, i.isInViewport ? e( i, f, o ) : t( i, f, o ) ) }, m ); return h.observe( o ), function() { return h.unobserve( o ) } } o.observeElementInViewport = e, o.isInViewport = function( o, t ) { return void 0 === t && ( t = {}
1489 ), new Promise( function( r, n ) { try { e( o, function( o, e ) { e(), r( !0 ) }, function( o, e ) { e(), r( !1 ) }, t ) } catch ( o ) { n( o ) } } ) } } ); 1490//# sourceMappingURL=index.umd.js.map 1491( function( theme, $ ) { 1492 1493 theme = theme || {}; 1494 1495 var instanceName = '__inviewportstyle'; 1496 1497 var PluginInViewportStyle = function( $el, opts ) { 1498 return this.initialize( $el, opts ); 1499 }; 1500 1501 PluginInViewportStyle.defaults = { 1502 viewport: window, 1503 scroll_bg_scale: false, 1504 scale_extra_class: '', 1505 set_round: '', 1506 scale_bg: '#08c', 1507 threshold: [0], 1508 modTop: '-200px', 1509 modBottom: '-200px', 1510 style: { 'transition': 'all 1s ease-in-out' }, 1511 styleIn: { 'background-color': '#08c' }, 1512 styleOut: { 'background-color': '#fff' }, 1513 }; 1514 1515 PluginInViewportStyle.prototype = { 1516 initialize: function( $el, opts ) { 1517 if ( $el.data( instanceName ) ) { 1518 return this; 1519 } 1520 1521 this.$el = $el; 1522 1523 this 1524 .setData() 1525 .setOptions( opts ) 1526 .build(); 1527 1528 return this; 1529 }, 1530 1531 setData: function() { 1532 this.$el.data( instanceName, this ); 1533 1534 return this; 1535 }, 1536 1537 setOptions: function( opts ) { 1538 this.options = $.extend( true, {}, PluginInViewportStyle.defaults, opts, {} ); 1539 1540 return this; 1541 }, 1542 1543 build: function() { 1544 var self = this, 1545 el = self.$el.get( 0 ); 1546 1547 if ( self.options.scroll_bg_scale && 'undefined' != typeof gsap ) { 1548 self.$scaleObject = $( '<div class="scale-expand position-absolute"></div>' ).addClass( self.options.scale_extra_class ); 1549 self.$el.addClass( 'view-scale-wrapper' ).append( self.$scaleObject ); 1550 self.$scaleObject.css( 'background-color', self.options.scale_bg ); 1551 self.scale = true; 1552 self.scaleEventFunc = self.scaleEvent.bind( this ); 1553 self.scaleEventFunc(); 1554 $( window ).on( 'scroll', self.scaleEventFunc ); 1555 } else { 1556 self.$el.css( self.options.style ); 1557 if ( typeof window.IntersectionObserver === 'function' ) { 1558 self.viewPort = observeElementInViewport.observeElementInViewport( 1559 el, function() { 1560 self.$el.css( self.options.styleIn ); 1561 }, function() { 1562 self.$el.css( self.options.styleOut ); 1563 }, { 1564 viewport: self.options.viewport, 1565 threshold: self.options.threshold, 1566 modTop: self.options.modTop, 1567 modBottom: self.options.modBottom 1568 } 1569 ) 1570 }; 1571 } 1572 1573 return this; 1574 }, 1575 scaleEvent: function() { 1576 var self = this, 1577 position = self.$el[0].getBoundingClientRect(); 1578 1579 if ( self.scale && position.top < window.innerHeight && position.bottom >= 0 ) { 1580 gsap.set( self.$scaleObject[0], { 1581 width: "150vmax", 1582 height: "150vmax", 1583 xPercent: -50, 1584 yPercent: -50, 1585 top: "50%", 1586 left: "50%" 1587 } ); 1588 1589 var scaleGsap = gsap.timeline( { 1590 scrollTrigger: { 1591 trigger: self.$el[0], 1592 start: "-50%", 1593 end: "0%", 1594 scrub: 2, 1595 invalidateOnRefresh: true, 1596 }, 1597 defaults: { 1598 ease: "none" 1599 } 1600 } ); 1601 1602 scaleGsap.fromTo( self.$scaleObject[0], { 1603 scale: 0 1604 }, { 1605 x: 0, 1606 y: 0, 1607 ease: "power3.in", 1608 scale: 1 1609 } ); 1610 self.scale = false; 1611 } 1612 }, 1613 disable: function() { 1614 var self = this; 1615 if ( self.options.scroll_bg_scale ) { 1616 self.$el.find( '.scale-expand' ).remove(); 1617 self.$el.removeClass( 'view-scale-wrapper' ) 1618 } else { 1619 self.$el.css( { 'background-color': '', 'transition': '' } ); 1620 self.viewPort(); 1621 } 1622 } 1623 }; 1624 1625 // expose to scope 1626 $.extend( theme, { 1627 PluginInViewportStyle: PluginInViewportStyle 1628 } ); 1629 1630 // jquery plugin 1631 $.fn.themePluginInViewportStyle = function( opts ) { 1632 return this.map( function() { 1633 var $this = $( this ); 1634 1635 if ( $this.data( instanceName ) ) { 1636 return $this.data( instanceName ); 1637 } else { 1638 return new PluginInViewportStyle( $this, opts ); 1639 } 1640 1641 } ); 1642 } 1643} ).apply( this, [window.theme, jQuery] ); 1644 1645// Sticky 1646( function( theme, $ ) { 1647 'use strict'; 1648 1649 // jQuery Pin plugin 1650 $.fn.themePin = function( options ) { 1651 var scrollY = 0, lastScrollY = 0, elements = [], disabled = false, $window = $( window ), fixedSideTop = [], fixedSideBottom = [], prevDataTo
1651= []; 1652 1653 options = options || {}; 1654 1655 var recalculateLimits = function() { 1656 for ( var i = 0, len = elements.length; i < len; i++ ) { 1657 var $this = elements[i]; 1658 if ( options.minWidth && window.innerWidth < options.minWidth ) { 1659 if ( $this.parent().hasClass( "pin-wrapper" ) ) { $this.unwrap(); } 1660 $this.css( { width: "", left: "", top: "", position: "" } ); 1661 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1662 $this.removeClass( 'sticky-transition' ); 1663 $this.removeClass( 'sticky-absolute' ); 1664 disabled = true; 1665 continue; 1666 } else { 1667 disabled = false; 1668 } 1669 1670 var $container = options.containerSelector ? ( $this.closest( options.containerSelector ).length ? $this.closest( options.containerSelector ) : $( options.containerSelector ) ) : $( document.body ), 1671 offset = $this.offset(), 1672 containerOffset = $container.offset(); 1673 1674 if ( typeof containerOffset == 'undefined' ) { 1675 continue; 1676 } 1677 1678 var parentOffset = $this.parent().offset(); 1679 1680 if ( !$this.parent().hasClass( "pin-wrapper" ) ) { 1681 $this.wrap( "<div class='pin-wrapper'>" ); 1682 if ( $this.hasClass( 'elementor-element-populated' ) ) { 1683 var $el_cont = $this.closest( '.elementor-container' ); 1684 if ( $el_cont.length ) { 1685 var matches = $el_cont.attr( 'class' ).match( /elementor-column-gap-([a-z]*)/g ); 1686 if ( matches && matches.length ) { 1687 var gap = matches[0].replace( 'elementor-column-gap-', '' ); 1688 $this.addClass( 'porto-gap-' + gap ); 1689 } 1690 } 1691 } 1692 } 1693 1694 var pad = $.extend( { 1695 top: 0, 1696 bottom: 0 1697 }, options.padding || {} ); 1698 1699 var $pin = $this.parent(), 1700 pt = parseInt( $pin.parent().css( 'padding-top' ) ), pb = parseInt( $pin.parent().css( 'padding-bottom' ) ); 1701 1702 if ( options.autoInit ) { 1703 if ( $( '#header' ).hasClass( 'header-side' ) ) { 1704 pad.top = theme.adminBarHeight(); 1705 /*if ($('.page-top.fixed-pos').length) { 1706 pad.top += $('.page-top.fixed-pos').height(); 1707 }*/ 1708 } else { 1709 pad.top = theme.adminBarHeight(); 1710 if ( $( '#header > .main-menu-wrap' ).length || !$( '#header' ).hasClass( 'sticky-menu-header' ) ) { 1711 pad.top += theme.StickyHeader.sticky_height; 1712 } 1713 } 1714 if ( typeof options.paddingOffsetTop != 'undefined' ) { 1715 pad.top += parseInt( options.paddingOffsetTop, 10 ); 1716 } else { 1717 pad.top += 18; 1718 } 1719 if ( typeof options.paddingOffsetBottom != 'undefined' ) { 1720 pad.bottom = parseInt( options.paddingOffsetBottom, 10 ); 1721 } else { 1722 pad.bottom = 0; 1723 } 1724 } 1725 1726 var bb = $this.css( 'border-bottom' ), h = $this.outerHeight(); 1727 $this.css( 'border-bottom', '1px solid transparent' ); 1728 var o_h = $this.outerHeight() - h - 1; 1729 $this.css( 'border-bottom', bb ); 1730 $this.css( { width: $this.outerWidth() <= $pin.width() ? $this.outerWidth() : $pin.width() } ); 1731 $pin.css( "height", $this.outerHeight() + o_h ); 1732 1733 if ( ( !options.autoFit && !options.fitToBottom ) || $this.outerHeight() <= $window.height() ) { 1734 $this.data( "themePin", { 1735 pad: pad, 1736 from: ( options.containerSelector ? containerOffset.top : offset.top ) - pad.top + pt, 1737 pb: pb, 1738 parentTop: parentOffset.top - pt, 1739 offset: o_h, 1740 stickyOffset: options.stickyOffset ? options.stickyOffset : 0 1741 } ); 1742 } else { 1743 $this.data( "themePin", { 1744 pad: pad, 1745 fromFitTop: ( options.containerSelector ? containerOffset.top : offset.top ) - pad.top + pt, 1746 from: ( options.containerSelector ? containerOffset.top : offset.top ) + $this.outerHeight() - window.innerHeight + pt, 1747 pb: pb, 1748 parentTop: parentOffset.top - pt, 1749 offset: o_h, 1750 stickyOffset: options.stickyOffset ? options.stickyOffset : 0 1751 } ); 1752 } 1753 } 1754 }; 1755 1756 var onScroll = function() { 1757 if ( disabled ) { return; } 1758 1759 scrollY = $window.scrollTop(); 1760 1761 var window_height = window.innerHeight || $window.height(); 1762 1763 for ( var i = 0, len = elements.length; i < len; i++ ) { 1764 var $this = $( elements[i] ), 1765 data = $this.data( "themePin" ), 1766 sidebarTop; 1767 1768 let contentWrap = $this.closest( '.porto-products-filter-body' ); 1769 let sidebarWrap = $this.closest( '.sidebar' ); 1770 if ( contentWrap.length && sidebarWrap.length ) { 1771 if ( $.contains( contentWrap[0], sidebarWrap[0] ) && !contentWrap.hasClass( 'opened' ) ) { 1772 continue; 1773 } 1774 } 1775 1776 if ( !data || typeof data.pad == 'undefined' ) { // Removed element 1777 continue; 1778 } 1779 1780 var $container = options.containerSelector ? ( $this.closest( options.containerSelector ).length ? $this.closest( options.containerSelector ) : $( options.containerSelector ) ) : $( document.body ), 1781 isFitToTop = ( !options.autoFit && !options.fitToBottom ) || ( $this.outerHeight() + data.pad.top ) <= window_height; 1782 data.end = $container.offset().top + $container.height(); 1783 if ( isFitToTop ) { 1784 data.to = $container.offset().top + $container.height() - $this.outerHeight() - data.pad.bottom - data.pb; 1785 } else { 1786 data.to = $container.offset().top + $container.height() - window_height - data.pb; 1787 data.to2 = $container.height() - $this.outerHeight() - data.pad.bottom - data.pb; 1788 } 1789 1790 if ( prevDataTo[i] === 0 ) { 1791 prevDataTo[i] = data.to; 1792 } 1793 1794 if ( isFitToTop ) { 1795 var from = data.from - data.pad.bottom, 1796 to = data.to - data.pad.top - data.offset, 1797 $parent = $this.closest( '.sticky-nav-wrapper' ), 1798 widgetTop; 1799 1800 // Sticky Navigation 1801 if ( $parent.length ) { 1802 widgetTop = $parent.offset().top - data.pad.top; 1803 if ( widgetTop > from ) { 1804 from = widgetTop; 1805 } 1806 } 1807 1808 if ( typeof data.fromFitTop != 'undefined' && data.fromFitTop ) { 1809 from = data.fromFitTop - data.pad.bottom; 1810 } 1811 1812 if ( from + $this.outerHeight() > data.end || from >= to ) { 1813 $this.css( { position: "", top: "", left: "" } ); 1814 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1815 $this.removeClass( 'sticky-transition' ); 1816 $this.removeClass( 'sticky-absolute' ); 1817 continue; 1818 } 1819 if ( scrollY > from + data.stickyOffset && scrollY < to ) { 1820 !( $this.css( "position" ) == "fixed" ) && $this.css( { 1821 left: $this.offset().left, 1822 top: data.pad.top 1823 } ).css( "position", "fixed" );
1824 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1825 $this.removeClass( 'sticky-transition' ); 1826 $this.removeClass( 'sticky-absolute' ); 1827 } else if ( scrollY >= to ) { 1828 $this.css( { 1829 left: "", 1830 top: to - data.parentTop + data.pad.top 1831 } ).css( "position", "absolute" ); 1832 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1833 if ( $this.hasClass( 'sticky-absolute' ) ) $this.addClass( 'sticky-transition' ); 1834 $this.addClass( 'sticky-absolute' ); 1835 } else { 1836 $this.css( { position: "", top: "", left: "" } ); 1837 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1838 $this.removeClass( 'sticky-transition' ); 1839 $this.removeClass( 'sticky-absolute' ); 1840 } 1841 } else if ( options.fitToBottom ) { 1842 var from = data.from, 1843 to = data.to; 1844 if ( data.from + window_height > data.end || data.from >= to ) { 1845 $this.css( { position: "", top: "", bottom: "", left: "" } ); 1846 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1847 $this.removeClass( 'sticky-transition' ); 1848 $this.removeClass( 'sticky-absolute' ); 1849 continue; 1850 } 1851 if ( scrollY > from && scrollY < to ) { 1852 !( $this.css( "position" ) == "fixed" ) && $this.css( { 1853 left: $this.offset().left, 1854 bottom: data.pad.bottom, 1855 top: "" 1856 } ).css( "position", "fixed" ); 1857 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1858 $this.removeClass( 'sticky-transition' ); 1859 $this.removeClass( 'sticky-absolute' ); 1860 } else if ( scrollY >= to ) { 1861 $this.css( { 1862 left: "", 1863 top: data.to2, 1864 bottom: "" 1865 } ).css( "position", "absolute" ); 1866 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1867 if ( $this.hasClass( 'sticky-absolute' ) ) $this.addClass( 'sticky-transition' ); 1868 $this.addClass( 'sticky-absolute' ); 1869 } else { 1870 $this.css( { position: "", top: "", bottom: "", left: "" } ); 1871 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1872 $this.removeClass( 'sticky-transition' ); 1873 $this.removeClass( 'sticky-absolute' ); 1874 } 1875 } else { // auto fit 1876 var this_height = $this.outerHeight() 1877 if ( prevDataTo[i] != data.to ) { 1878 if ( fixedSideBottom[i] && this_height + $this.offset().top + data.pad.bottom < scrollY + window_height ) { 1879 fixedSideBottom[i] = false; 1880 } 1881 } 1882 if ( ( this_height + data.pad.top + data.pad.bottom ) > window_height || fixedSideTop[i] || fixedSideBottom[i] ) { 1883 var padTop = parseInt( $this.parent().parent().css( 'padding-top' ) ); 1884 // Reset the sideSortables style when scrolling to the top. 1885 if ( scrollY + data.pad.top - padTop <= data.parentTop ) { 1886 $this.css( { position: "", top: "", bottom: "", left: "" } ); 1887 fixedSideTop[i] = fixedSideBottom[i] = false; 1888 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1889 } else if ( scrollY >= data.to ) { 1890 $this.css( { 1891 left: "", 1892 top: data.to2, 1893 bottom: "" 1894 } ).css( "position", "absolute" ); 1895 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1896 } else { 1897 1898 // When scrolling down. 1899 if ( scrollY >= lastScrollY ) { 1900 if ( fixedSideTop[i] ) { 1901 1902 // Let it scroll. 1903 fixedSideTop[i] = false; 1904 sidebarTop = $this.offset().top - data.parentTop; 1905 1906 $this.css( { 1907 left: "", 1908 top: sidebarTop, 1909 bottom: "" 1910 } ).css( "position", "absolute" ); 1911 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1912 } else if ( !fixedSideBottom[i] && this_height + $this.offset().top + data.pad.bottom < scrollY + window_height ) { 1913 // Pin the bottom. 1914 fixedSideBottom[i] = true; 1915 1916 !( $this.css( "position" ) == "fixed" ) && $this.css( { 1917 left: $this.offset().left, 1918 bottom: data.pad.bottom, 1919 top: "" 1920 } ).css( "position", "fixed" );
1921 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1922 } 1923 1924 // When scrolling up. 1925 } else if ( scrollY < lastScrollY ) { 1926 if ( fixedSideBottom[i] ) { 1927 // Let it scroll. 1928 fixedSideBottom[i] = false; 1929 sidebarTop = $this.offset().top - data.parentTop; 1930 1931 /*if ($this.css('position') == 'absolute' && sidebarTop > data.to2) { 1932 sidebarTop = data.to2; 1933 }*/ 1934 $this.css( { 1935 left: "", 1936 top: sidebarTop, 1937 bottom: "" 1938 } ).css( "position", "absolute" ); 1939 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1940 } else if ( !fixedSideTop[i] && $this.offset().top >= scrollY + data.pad.top ) { 1941 // Pin the top. 1942 fixedSideTop[i] = true; 1943 1944 !( $this.css( "position" ) == "fixed" ) && $this.css( { 1945 left: $this.offset().left, 1946 top: data.pad.top, 1947 bottom: '' 1948 } ).css( "position", "fixed" ); 1949 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1950 } else if ( !fixedSideBottom[i] && fixedSideTop[i] && $this.css( 'position' ) == 'absolute' && $this.offset().top >= scrollY + data.pad.top ) { 1951 fixedSideTop[i] = false; 1952 } 1953 } 1954 } 1955 } else { 1956 // If the sidebar container is smaller than the viewport, then pin/unpin the top when scrolling. 1957 if ( scrollY >= ( data.parentTop - data.pad.top ) ) { 1958 $this.css( { 1959 position: 'fixed', 1960 top: data.pad.top 1961 } ); 1962 } else { 1963 $this.css( { position: "", top: "", bottom: "", left: "" } ); 1964 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1965 } 1966 1967 fixedSideTop[i] = fixedSideBottom[i] = false; 1968 } 1969 } 1970 1971 prevDataTo[i] = data.to; 1972 } 1973 1974 lastScrollY = scrollY; 1975 }; 1976 1977 var update = function() { recalculateLimits(); onScroll(); }, 1978 r_timer = null; 1979 1980 this.each( function() { 1981 var $this = $( this ), 1982 data = $this.data( 'themePin' ) || {}; 1983 1984 if ( data && data.update ) { return; } 1985 elements.push( $this ); 1986 $( "img", this ).one( "load", function() { 1987 if ( r_timer ) { 1988 theme.deleteTimeout( r_timer ); 1989 } 1990 r_timer = theme.requestFrame( recalculateLimits ); 1991 } ); 1992 data.update = update; 1993 $this.data( 'themePin', data ); 1994 fixedSideTop.push( false ); 1995 fixedSideBottom.push( false ); 1996 prevDataTo.push( 0 ); 1997 } ); 1998 1999 //$window.on( 'touchmove', onScroll ); 2000 window.addEventListener( 'touchmove', onScroll, { passive: true } ); 2001 window.addEventListener( 'scroll', onScroll, { passive: true } ); 2002 recalculateLimits(); 2003 2004 if ( !theme.isLoaded ) { 2005 $window.on( 'load', update ); 2006 } else { 2007 update(); 2008 } 2009 2010 $( this ).on( 'recalc.pin', function() { 2011 recalculateLimits(); 2012 onScroll(); 2013 } ); 2014 2015 return this; 2016 }; 2017 2018 theme = theme || {}; 2019 2020 var instanceName = '__sticky'; 2021 2022 var Sticky = function( $el, opts ) { 2023 return this.initialize( $el, opts ); 2024 }; 2025 2026 Sticky.defaults = { 2027 autoInit: false, 2028 minWidth: 767, 2029 activeClass: 'sticky-active', 2030 padding: { 2031 top: 0, 2032 bottom: 0 2033 }, 2034 offsetTop: 0, 2035 offsetBottom: 0, 2036 autoFit: false, 2037 fitToBottom: false, 2038 stickyOffset: 0 2039 }; 2040 2041 Sticky.prototype = { 2042 initialize: function( $el, opts ) { 2043 if ( $el.data( instanceName ) ) { 2044 return this; 2045 } 2046 2047 this.$el = $el; 2048 2049 this 2050 .setData() 2051 .setOptions( opts ) 2052 .build(); 2053 2054 return this; 2055 }, 2056 2057 setData: function() { 2058 this.$el.data( instanceName, this ); 2059 2060 return this; 2061 }, 2062 2063 setOptions: function( opts ) { 2064 this.options = $.extend( true, {}, Sticky.defaults, opts, { 2065 wrapper: this.$el 2066 } ); 2067 2068 return this; 2069 }, 2070 2071 build: function() { 2072 if ( !$.fn.themePin ) { 2073 return this; 2074 } 2075 2076 var self = this, 2077 $el = this.options.wrapper, 2078 stickyResizeTrigger; 2079 2080 if ( $el.hasClass( 'porto-sticky-nav' ) ) { 2081 this.options.padding.top = theme.StickyHeader.sticky_height + theme.adminBarHeight(); 2082 this.options.activeClass = 'sticky-active'; 2083 this.options.containerSelector = '.main-content-wrap'; 2084 theme.sticky_nav_height = $el.outerHeight(); 2085 if ( this.options.minWidth > window.innerWidth ) 2086 theme.sticky_nav_height = 0; 2087 2088 var porto_progress_obj = $( '.porto-scroll-progress.fixed-top:not(.fixed-under-header)' ); 2089 if ( porto_progress_obj.length ) { 2090 var flag = false; 2091 if ( porto_progress_obj.is( ':hidden' ) ) { 2092 porto_progress_obj.show(); 2093 flag = true; 2094 } 2095 if ( flag ) { 2096 porto_progress_obj.hide(); 2097 } 2098 } 2099 2100 var offset = theme.adminBarHeight() + theme.StickyHeader.sticky_height - 1, 2101 $transitionOffset = ( offset > 100 ) ? offset : 100; 2102 2103 this.options.stickyOffset = theme.sticky_nav_height + $transitionOffset; 2104 var init_filter_widget_sticky = function() { 2105 var prevScrollPos = $el.data('prev-pos') ? $el.data('prev-pos') : 0, 2106 scrollUpOffset = 0, 2107 objHeight = $el.outerHeight() + parseInt( $el.css( 'margin-bottom' ) ), 2108 scrollTop = $( window ).scrollTop(); 2109 2110 if ( $( '.page-wrapper' ).hasClass( 'sticky-scroll-up' ) ) { 2111 if ( scrollTop >= prevScrollPos ) { 2112 $el.addClass('scroll-down'); 2113 } else { 2114 $el.removeClass('scroll-down'); 2115 } 2116 2117 // Header is scroll-up Sticky Type 2118 scrollUpOffset = - theme.StickyHeader.sticky_height; 2119 if ( 'undefined' == typeof ( theme.StickyHeader.sticky_height ) ) { 2120 $el.data( 'prev-pos', 0 ); 2121 } else { 2122 // The transition of Sticky isn't working in this area 2123 if ( $el.parent().offset().top + objHeight + $transitionOffset < scrollTop + offset + scrollUpOffset ) { 2124 $el.addClass( 'sticky-ready' ); 2125 } else { 2126 $el.removeClass( 'sticky-ready' ); 2127 } 2128 $el.data( 'prev-pos', scrollTop ); 2129 } 2130 } 2131 } 2132 2133 if ( this.options.minWidth <= window.innerWidth ) { 2134 window.removeEventListener( 'scroll', init_filter_widget_sticky ); 2135 window.addEventListener( 'scroll', init_filter_widget_sticky, { passive: true } ); 2136 init_filter_widget_sticky(); 2137 } 2138 } 2139 2140 $el.themePin( this.options ); 2141 2142 $( window ).smartresize( function() { 2143 if ( stickyResizeTrigger ) { 2144 clearTimeout( stickyResizeTrigger ); 2145 } 2146 stickyResizeTrigger = setTimeout( function() {
2147 $el.trigger( 'recalc.pin' ); 2148 }, 800 ); 2149 2150 var $parent = $el.parent(); 2151 2152 $el.outerWidth( $parent.width() ); 2153 if ( $el.css( 'position' ) == 'fixed' ) { 2154 $el.css( 'left', $parent.offset().left ); 2155 } 2156 2157 if ( $el.hasClass( 'porto-sticky-nav' ) ) { 2158 theme.sticky_nav_height = $el.outerHeight(); 2159 if ( self.options.minWidth > window.innerWidth ) 2160 theme.sticky_nav_height = 0; 2161 } 2162 } ); 2163 2164 return this; 2165 } 2166 }; 2167 2168 // expose to scope 2169 $.extend( theme, { 2170 Sticky: Sticky 2171 } ); 2172 2173 // jquery plugin 2174 $.fn.themeSticky = function( opts ) { 2175 return this.map( function() { 2176 var $this = $( this ); 2177 if ( $this.data( instanceName ) ) { 2178 $this.trigger( 'recalc.pin' ); 2179 setTimeout( function() { 2180 $this.trigger( 'recalc.pin' ); 2181 }, 800 ); 2182 2183 return $this.data( instanceName ); 2184 } else { 2185 return new theme.Sticky( $this, opts ); 2186 } 2187 2188 } ); 2189 } 2190 2191} ).apply( this, [window.theme, jQuery] ); 2192 2193 2194// Mobile Panel 2195( function( theme, $ ) { 2196 'use strict'; 2197 2198 $( function() { 2199 $( document.body ).on( 'click', '.mobile-toggle', function( e ) { 2200 var $nav_panel = $( '#nav-panel' ); 2201 if ( $nav_panel.length > 0 ) { 2202 if ( $( this ).closest( '.header-main' ).length && $nav_panel.closest( '.header-builder-p' ).length && !$nav_panel.parent( '.header-main' ).length ) { 2203 $nav_panel.appendTo( $( this ).closest( '.header-main' ) ); 2204 } else if ( $( this ).closest( '.header-main' ).length && $nav_panel.closest( '.wp-block-template-part' ).length ) { 2205 $nav_panel.insertAfter( $( this ).closest( '.header-main' ) ); 2206 } 2207 2208 if ( $nav_panel.is( ':visible' ) && $( '#header' ).hasClass( 'sticky-header' ) ) { 2209 var h_h = $( '#header' ).height(), p_h = $nav_panel.outerHeight(); 2210 if ( h_h > p_h + 30 ) { 2211 $( '#header' ).css( 'height', h_h - p_h ); 2212 } 2213 } 2214 $nav_panel.stop().slideToggle(); 2215 } else if ( $( '#side-nav-panel' ).length > 0 ) { 2216 $( 'html' ).toggleClass( 'panel-opened' ); 2217 $( '.panel-overlay' ).toggleClass( 'active' ); 2218 if ( $( '#side-nav-panel' ).hasClass( 'panel-right' ) ) { 2219 $( 'html' ).addClass( 'panel-right-opened' ); 2220 } 2221 } 2222 if ( $( '#nav-panel .skeleton-body, #side-nav-panel .skeleton-body' ).length ) { 2223 theme.lazyload_menu( 1, 'mobile_menu' ); 2224 } 2225 e.preventDefault(); 2226 } ); 2227 2228 $( document.body ).on( 'click', '.panel-overlay', function() { 2229 $( 'html' ).css( 'transition', 'margin .3s' ).removeClass( 'panel-opened' ).removeClass( 'panel-right-opened' ); 2230 theme.requestTimeout( function() { 2231 $( 'html' ).css( 'transition', '' ); 2232 }, 260 ); 2233 $( this ).removeClass( 'active' ); 2234 } ); 2235 2236 $( document.body ).on( 'click', '.side-nav-panel-close', function( e ) { 2237 e.preventDefault(); 2238 $( '.panel-overlay' ).trigger( 'click' ); 2239 } ); 2240 2241 $( document.body ).on( 'click', '#side-nav-panel .mobile-tab-items .nav-item', function( e ) { 2242 e.preventDefault(); 2243 var $this = $( this ), 2244 $id = $this.attr('pane-id'), 2245 $parent = $this.closest('.mobile-tabs'); 2246 2247 if ( $id ) { 2248 $parent.find('.active').removeClass( 'active' ); 2249 $this.addClass('active'); 2250 $parent.find('.mobile-tab-content [tab-id="' + $id + '"]').addClass( 'active' ); 2251 } 2252 } ); 2253 2254 $( window ).on( 'resize', function() { 2255 if ( window.innerWidth > 991 ) { 2256 $( '#nav-panel' ).hide(); 2257 if ( $( 'html' ).hasClass( 'panel-opened' ) ) { 2258 $( '.panel-overlay' ).trigger( 'click' ); 2259 } 2260 } 2261 } ); 2262 } ); 2263 2264} ).apply( this, [window.theme, jQuery] ); 2265 2266 2267// Blog / Portfolio Like 2268( function( theme, $ ) { 2269 'use strict'; 2270 2271 $( function() { 2272 $( document ).on( 'click', '.blog-like, .portfolio-like', function( e ) { 2273 e.preventDefault(); 2274 var $this = $( this ), 2275 parentObj = this.parentNode, 2276 item_id = $this.attr( 'data-id' ), 2277 is_blog = $this.hasClass( 'blog-like' ), 2278 sendData = { nonce: js_porto_vars.porto_nonce }; 2279 if ( is_blog ) { 2280 if ( $this.hasClass( 'updating' ) ) { 2281 return false; 2282 } 2283 $this.addClass( 'updating' ).text( '...' ); 2284 sendData.blog_id = item_id; 2285 sendData.action = 'porto_blog-like'; 2286 } else { 2287 sendData.portfolio_id = item_id; 2288 sendData.action = 'porto_portfolio-like'; 2289 } 2290 $.post( 2291 theme.ajax_url, 2292 sendData, 2293 function( data ) { 2294 if ( data ) { 2295 $this.remove(); 2296 parentObj.innerHTML = data; 2297 if ( typeof bootstrap != 'undefined' ) { 2298 var tooltipTriggerList = [].slice.call( parentObj.querySelectorAll( '[data-bs-tooltip]' ) ); 2299 tooltipTriggerList.map( function( tooltipTriggerEl ) { 2300 return new bootstrap.Tooltip( tooltipTriggerEl ) 2301 } ); 2302 } 2303 } 2304 } 2305 ); 2306 return false; 2307 } ); 2308 } ); 2309 2310} ).apply( this, [window.theme, jQuery] ); 2311 2312// Scroll to Top 2313 2314//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com. 2315//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09') 2316//** v1.1 (April 7th, 09'): 2317//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead. 2318//** 2) Fixes scroll animation not working in Opera. 2319 2320 2321var scrolltotop = { 2322 //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control 2323 //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top). 2324 setting: { startline: 100, scrollto: 0, scrollduration: 1000, fadeduration: [500, 100] }, 2325 controlHTML: '<img src="assets/img/up.png" style="width:40px; height:40px" />
2325', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol" 2326 controlattrs: { offsetx: 10, offsety: 10 }, //offset of control relative to right/ bottom of window corner 2327 anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links 2328 2329 state: { isvisible: false, shouldvisible: false }, 2330 2331 scrollup: function() { 2332 if ( !this.cssfixedsupport ) //if control is positioned using JavaScript 2333 this.$control.css( { opacity: 0 } ); //hide control immediately after clicking it 2334 var dest = isNaN( this.setting.scrollto ) ? this.setting.scrollto : parseInt( this.setting.scrollto ); 2335 if ( typeof dest == "string" && jQuery( '#' + dest ).length == 1 ) //check element set by string exists 2336 dest = jQuery( '#' + dest ).offset().top; 2337 else 2338 dest = 0; 2339 this.$body.stop().animate( { scrollTop: dest }, this.setting.scrollduration ); 2340 }, 2341 2342 keepfixed: function() { 2343 var $window = jQuery( window ); 2344 var controlx = $window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx; 2345 var controly = $window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety; 2346 this.$control.css( { left: controlx + 'px', top: controly + 'px' } ); 2347 }, 2348 2349 togglecontrol: function() { 2350 var scrolltop = jQuery( window ).scrollTop(); 2351 if ( !this.cssfixedsupport ) 2352 this.keepfixed(); 2353 this.state.shouldvisible = ( scrolltop >= this.setting.startline ) ? true : false; 2354 if ( this.state.shouldvisible && !this.state.isvisible ) { 2355 this.$control.stop().animate( { opacity: 1 }, this.setting.fadeduration[0] ); 2356 this.state.isvisible = true; 2357 } 2358 else if ( this.state.shouldvisible == false && this.state.isvisible ) { 2359 this.$control.stop().animate( { opacity: 0 }, this.setting.fadeduration[1] ); 2360 this.state.isvisible = false; 2361 } 2362 }, 2363 2364 init: function() { 2365 jQuery( document ).ready( function( $ ) { 2366 var mainobj = scrolltotop; 2367 var iebrws = document.all; 2368 mainobj.cssfixedsupport = !iebrws || iebrws && document.compatMode == "CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode 2369 mainobj.$body = ( window.opera ) ? ( document.compatMode == "CSS1Compat" ? $( 'html' ) : $( 'body' ) ) : $( 'html,body' ); 2370 mainobj.$control = $( '<div id="topcontrol">' + mainobj.controlHTML + '</div>' ) 2371 .css( { position: mainobj.cssfixedsupport ? 'fixed' : 'absolute', bottom: mainobj.controlattrs.offsety, opacity: 0, cursor: 'pointer' } ) 2372 .attr( { title: '' } ) 2373 .on( 'click', function() { mainobj.scrollup(); return false; } ) 2374 .appendTo( 'body' ); 2375 if ( document.all && !window.XMLHttpRequest && mainobj.$control.text() != '' ) //loose check for IE6 and below, plus whether control contains any text 2376 mainobj.$control.css( { width: mainobj.$control.width() } ); //IE6- seems to require an explicit width on a DIV containing text 2377 mainobj.togglecontrol(); 2378 $( 'a[href="' + mainobj.anchorkeyword + '"]' ).on( 'click', function() { 2379 mainobj.scrollup(); 2380 return false; 2381 } ); 2382 $( window ).on( 'scroll resize', function( e ) { 2383 mainobj.togglecontrol(); 2384 } ); 2385 } ); 2386 } 2387}; 2388 2389//scrolltotop.init() 2390 2391( function( theme, $ ) { 2392 'use strict'; 2393 theme = theme || {}; 2394 2395 $.extend( theme, { 2396 2397 ScrollToTop: { 2398 2399 defaults: { 2400 html: '<i class="fas fa-chevron-up"></i>', 2401 offsetx: 10, 2402 offsety: 0 2403 }, 2404 2405 initialize: function( html, offsetx, offsety ) { 2406 if ( $( '#topcontrol' ).length ) { 2407 return this; 2408 } 2409 this.html = ( html || this.defaults.html ); 2410 this.offsetx = ( offsetx || this.defaults.offsetx ); 2411 this.offsety = ( offsety || this.defaults.offsety ); 2412 2413 this.build(); 2414 2415 return this; 2416 }, 2417 2418 build: function() { 2419 var self = this; 2420 2421 if ( typeof scrolltotop !== 'undefined' ) { 2422 // scroll top control 2423 scrolltotop.controlHTML = self.html; 2424 scrolltotop.controlattrs = { offsetx: self.offsetx, offsety: self.offsety }; 2425 scrolltotop.init(); 2426 } 2427 2428 return self; 2429 } 2430 } 2431 2432 } ); 2433 2434} ).apply( this, [window.theme, jQuery] ); 2435 2436 2437// Mega Menu 2438( function( theme, $ ) { 2439 'use strict'; 2440 2441 theme = theme || {}; 2442 2443 $.extend( theme, { 2444 2445 MegaMenu: { 2446 2447 defaults: { 2448 menu: $( '.mega-menu' ) 2449 }, 2450 2451 initialize: function( $menu ) { 2452 this.$menu = ( $menu || this.defaults.menu ); 2453 2454 this.events(); // Include the build function 2455 2456 return this; 2457 }, 2458 2459 popupWidth: function() { 2460 var winWidth = window.innerWidth, 2461 popupWidth = theme.bodyWidth - theme.grid_gutter_width * 2; 2462 if ( !$( 'body' ).hasClass( 'wide' ) ) { 2463 if ( winWidth >= theme.container_width + theme.grid_gutter_width - 1 ) 2464 popupWidth = theme.container_width - theme.grid_gutter_width; 2465 else if ( winWidth >= 992 ) 2466 popupWidth = 960 - theme.grid_gutter_width; 2467 else if ( winWidth >= 768 ) 2468 popupWidth = 720 - theme.grid_gutter_width; 2469 } 2470 return popupWidth; 2471 }, 2472 2473 calcMenuPosition: function( menu_obj ) { 2474 var menu = menu_obj, 2475 $header_container = $( '#header .header-main' ).hasClass( 'elementor-section' ) ? $( '#header .header-main > .elementor-container' ) : ( $( "#header .header-main .container-fluid" ).length ? $( "#header .header-main .container-fluid" ) : ( $( "#header .header-main .container" ).length ? $( "#header .header-main .container" ) : null ) ); 2476 if ( null === $header_container || !$header_container.length ) { 2477 var $pr = menu.closest( '.elementor-top-section' ); 2478 if ( $pr.length ) { 2479 $header_container = $pr.children( '.elementor-container' ); 2480 } else { 2481 $header_container = menu.closest( '.e-con-inner, .container, .container-fluid' ).eq(0); 2482 } 2483 if ( !$header_container.length ) { 2484 return; 2485 } 2486 } 2487 2488 var menuContainerWidth = $header_container.outerWidth() - parseInt( $header_container.css( 'padding-left' ) ) - parseInt( $header_container.css( 'padding-right' ) ); 2489 if ( menuContainerWidth < 900 ) return; 2490 2491 var is_full = false; 2492 if ( menu.parent().hasClass( 'pos-fullwidth' ) ) { 2493 is_full = true; 2494 menu.get( 0 ).style.width = menuContainerWidth + 'px'; 2495 } 2496 var browserWidth = theme.bodyWidth, 2497 menuLeftPos = menu.offset().left - ( browserWidth - menuContainerWidth ) / 2; 2498 if ( window.theme.rtl ) { 2499 menuLeftPos = theme.bodyWidth - ( menu.offset().left + menu.outerWidth() ) - ( browserWidth - menuContainerWidth ) / 2; 2500 } 2501 var menuWidth = menu.width(), 2502 remainWidth = menuContainerWidth - ( menuLeftPos + menuWidth ), 2503 l = false; 2504 if ( menuLeftPos > remainWidth && menuLeftPos < menuWidth ) { 2505 l = ( menuLeftPos + remainWidth ) / 3; 2506 } 2507 if ( 0 === remainWidth && ( is_full || 0 === menuLeftPos ) ) { 2508 return 0; 2509 } 2510 if ( remainWidth < 0 ) { 2511 l = -remainWidth; 2512 } 2513 return l; 2514 }, 2515 2516 build: function( $menu ) { 2517 var self = this; 2518 if ( !$menu ) { 2519 $menu = self.$menu; 2520 } 2521 2522 $menu.each( function() { 2523 var $menu = $( this ), 2524 $menu_container = $menu.closest( '.container' ), 2525 container_width = self.popupWidth(); 2526 if ( $menu.closest( '.porto-popup-menu' ).length ) { 2527 return false; 2528 } 2529 2530 var $menu_items = $menu.children( 'li.has-sub' ); 2531 2532 $menu_items.each( function() { 2533 var $menu_item = $( this ), 2534 $popup = $menu_item.children( '.popup' ); 2535 if ( $popup.length ) { 2536 var popup_obj = $popup.get( 0 ); 2537 popup_obj.style.display = 'block'; 2538 if ( $menu_item.hasClass( 'wide' ) ) { 2539 popup_obj.style.left = 0; 2540 var padding = parseInt( $popup.css( 'padding-left' ) ) + parseInt( $popup.css( 'padding-right' ) ) + 2541 parseInt( $popup.find( '> .inner' ).css( 'padding-left' ) ) + parseInt( $popup.find( '> .inner' ).css( 'padding-right' ) ); 2542 2543 var row_number = 4; 2544 2545 if ( $menu_item.hasClass( 'col-2' ) ) row_number = 2; 2546 if ( $menu_item.hasClass( 'col-3' ) ) row_number = 3; 2547 if ( $menu_item.hasClass( 'col-4' ) ) row_number = 4; 2548 if ( $menu_item.hasClass( 'col-5' ) ) row_number = 5; 2549 if ( $menu_item.hasClass( 'col-6' ) ) row_number = 6; 2550 2551 if ( window.innerWidth < 992 ) 2552 row_number = 1; 2553 2554 var col_length = 0; 2555 $popup.find( '> .inner > ul > li' ).each( function() { 2556 var cols = parseFloat( $( this ).attr( 'data-cols' ) ); 2557 if ( cols <= 0 || !cols ) 2558 cols = 1; 2559 2560 if ( cols > row_number ) 2561 cols = row_number; 2562 2563 col_length += cols; 2564 } ); 2565 2566 if ( col_length > row_number ) col_length = row_number; 2567 2568 var popup_max_width = $popup.data( 'popup-mw' ) ? $popup.data( 'popup-mw' ) : $popup.find( '.inner' ).css( 'max-width' ), 2569 col_width = container_width / row_number; 2570 if ( 'none' !== popup_max_width && popup_max_width < container_width ) { 2571 col_width = parseInt( popup_max_width ) / row_number; 2572 } 2573 2574 $popup.find( '> .inner > ul > li' ).each( function() { 2575 var cols = parseFloat( $( this ).data( 'cols' ) ); 2576 if ( cols <= 0 ) 2577 cols = 1; 2578 2579 if ( cols > row_number ) 2580 cols = row_number; 2581 2582 if ( $menu_item.hasClass( 'pos-center' ) || $menu_item.hasClass( 'pos-left' ) || $menu_item.hasClass( 'pos-right' ) ) 2583 this.style.width = ( 100 / col_length * cols ) + '%'; 2584 else 2585 this.style.width = ( 100 / row_number * cols ) + '%'; 2586 } ); 2587 2588 if ( $menu_item.hasClass( 'pos-center' ) ) { // position center 2589 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( col_width * col_length - padding ) + 'px'; 2590 var left_position = $popup.offset().left - ( theme.bodyWidth - col_width * col_length ) / 2; 2591 popup_obj.style.left = '-' + left_position + 'px'; 2592 } else if ( $menu_item.hasClass( 'pos-left' ) ) { // position left 2593 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( col_width * col_length - padding ) + 'px'; 2594 popup_obj.style.left = '-15px'; 2595 } else if ( $menu_item.hasClass( 'pos-right' ) ) { // position right 2596 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( col_width * col_length - padding ) + 'px'; 2597 popup_obj.style.right = '-15px'; 2598 popup_obj.style.left = 'auto'; 2599 } else { // position justify 2600 if ( !$menu_item.hasClass( 'pos-fullwidth' ) ) { 2601 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( container_width - padding ) + 'px'; 2602 } 2603 if ( theme.rtl ) { 2604 popup_obj.style.right = 0; 2605 popup_obj.style.left = 'auto'; 2606 } 2607 setTimeout( () => { 2608 var left_position = self.calcMenuPosition( $popup ); 2609 if ( theme.rtl ) { 2610 popup_obj.style.left = 'auto'; 2611 if ( left_position ) { 2612 popup_obj.style.right = '-' + left_position + 'px'; 2613 } else if ( 0 !== left_position ) { 2614 popup_obj.style.right = '-15px'; 2615 } 2616 } else { 2617 popup_obj.style.right = 'auto'; 2618 if ( left_position ) { 2619 popup_obj.style.left = '-' + left_position + 'px'; 2620 } else if ( 0 !== left_position ) { 2621 popup_obj.style.left = '-15px'; 2622 } 2623 } 2624 } ); 2625 2626 } 2627 } else { // auto position 2628 if ( $menu_item.hasClass( 'pos-center' ) ) { // position center 2629 2630 } else if ( $menu_item.hasClass( 'pos-left' ) ) { // position left 2631 2632 } else if ( $menu_item.hasClass( 'pos-right' ) ) { // position right 2633 2634 } else { // position justify 2635 if ( $popup.offset().left + $popup.width() > window.innerWidth ) { 2636 $menu_item.addClass( 'pos-right' ); 2637 } else if ( $popup.find( '> .inner > ul' ).length ) { 2638 var $sub_menu = $popup.find( '> .inner > ul' ).eq( 0 ); 2639 if ( $sub_menu.offset().left + $sub_menu.width() + 200 > window.innerWidth ) { 2640 $sub_menu.addClass( 'pos-left' ); 2641 } 2642 } 2643 } 2644 } 2645 $menu_item.addClass( 'sub-ready' ); 2646 } 2647 } ); 2648 } ); 2649 2650 return self; 2651 }, 2652 2653 events: function() { 2654 var self = this; 2655 2656 $( window ).smartresize( function( e ) { 2657 if ( e.originalEvent ) { 2658 self.build(); 2659 } 2660 } ); 2661 2662 if ( theme.isLoaded ) { 2663 theme.requestFrame( function() { 2664 self.build(); 2665 } ); 2666 } else { 2667 $( window ).on( 'load', function() { 2668 theme.requestFrame( function() { 2669 self.build(); 2670 } ); 2671 } ); 2672 } 2673 2674 return self; 2675 } 2676 } 2677 2678 } ); 2679 2680} ).apply( this, [window.theme, jQuery] ); 2681 2682 2683// Sidebar Menu 2684( function( theme, $ ) { 2685 'use strict'; 2686 2687 theme = theme || {}; 2688 2689 $.extend( theme, { 2690 2691 SidebarMenu: { 2692 2693 defaults: { 2694 menu: $( '.sidebar-menu:not(.side-menu-accordion)' ), 2695 toggle: $( '.widget_sidebar_menu .widget-title .toggle' ), 2696 menu_toggle: $( '#main-toggle-menu .menu-title' ) 2697 }, 2698 2699 rtl: theme.rtl, 2700 2701 initialize: function( $menu, $toggle, $menu_toggle ) { 2702 if ( this.$menu && this.$menu.length && $menu && $menu.length ) { 2703 this.$menu = $.uniqueSort( $.merge( this.$menu, $menu ) ); 2704 this.build(); 2705 return this; 2706 } 2707 this.$menu = ( $menu || this.defaults.menu ); 2708 if ( !this.$menu.length ) { 2709 return this; 2710 } 2711 this.$toggle = ( $toggle || this.defaults.toggle ); 2712 this.$menu_toggle = ( $menu_toggle || this.defaults.menu_toggle ); 2713 2714 this.events(); 2715 2716 return this; 2717 }, 2718 2719 isRightSidebar: function( $menu ) { 2720 var flag = false; 2721 if ( this.rtl ) { 2722 flag = !( $( '#main' ).hasClass( 'column2-right-sidebar' ) || $( '#main' ).hasClass( 'column2-wide-right-sidebar' ) ); 2723 } else { 2724 flag = $( '#main' ).hasClass( 'column2-right-sidebar' ) || $( '#main' ).hasClass( 'column2-wide-right-sidebar' ); 2725 } 2726 2727 if ( $menu.closest( '#main-toggle-menu' ).length ) { 2728 if ( this.rtl ) { 2729 flag = true; 2730 } else { 2731 flag = false; 2732 } 2733 } 2734 2735 var $header_wrapper = $menu.closest( '.header-wrapper' ); 2736 if ( $header_wrapper.length && $header_wrapper.hasClass( 'header-side-nav' ) ) { 2737 if ( this.rtl ) { 2738 flag = true; 2739 } else { 2740 flag = false; 2741 } 2742 if ( $( '.page-wrapper' ).hasClass( 'side-nav-right' ) ) { 2743 if ( this.rtl ) { 2744 flag = false; 2745 } else { 2746 flag = true; 2747 } 2748 } 2749 } 2750 2751 return flag; 2752 }, 2753 2754 popupWidth: function() { 2755 var winWidth = window.innerWidth, 2756 popupWidth = theme.bodyWidth - theme.grid_gutter_width * 2; 2757 if ( !$( 'body' ).hasClass( 'wide' ) ) { 2758 if ( winWidth >= theme.container_width + theme.grid_gutter_width - 1 ) 2759 popupWidth = theme.container_width - theme.grid_gutter_width; 2760 else if ( winWidth >= 992 ) 2761 popupWidth = 960 - theme.grid_gutter_width; 2762 else if ( winWidth >= 768 ) 2763 popupWidth = 720 - theme.grid_gutter_width; 2764 } 2765 return popupWidth; 2766 }, 2767 2768 build: function( $menus ) { 2769 var self = this; 2770 if ( !$menus ) { 2771 $menus = self.$menu; 2772 } 2773 if ( !$menus.length ) { 2774 return; 2775 } 2776 2777 var $parent_toggle_wrap = $menus.parent( '.toggle-menu-wrap' ), 2778 parent_toogle_wrap = null; 2779 if ( $parent_toggle_wrap.length && $parent_toggle_wrap.is( ':hidden' ) ) { 2780 parent_toogle_wrap = $parent_toggle_wrap.get( 0 ); 2781 parent_toogle_wrap.style.display = 'block'; 2782 parent_toogle_wrap.style.visibility = 'hidden'; 2783 } 2784 2785 $menus.each( function() {
2786 var menuobj = this, $menu = $( this ), container_width; 2787 if ( menuobj.classList.contains( 'side-menu-slide' ) ) { 2788 return; 2789 } 2790 if ( window.innerWidth < 992 ) 2791 container_width = self.popupWidth(); 2792 else { 2793 var menu_width = this.offsetWidth ? this.offsetWidth : $menu.width(); 2794 container_width = self.popupWidth() - menu_width - 45; 2795 } 2796 2797 var is_right_sidebar = self.isRightSidebar( $menu ), 2798 $menu_items = $menu.children( 'li' ); 2799 2800 $menu_items.each( function() { 2801 var $menu_item = $( this ), 2802 $popup = $menu_item.children( '.popup' ); 2803 2804 if ( $popup.length ) { 2805 var popup_obj = $popup.get( 0 ), 2806 is_opened = false; 2807 if ( $popup.is( ':visible' ) ) { 2808 is_opened = true; 2809 } else { 2810 popup_obj.style.display = 'block'; 2811 } 2812 if ( $menu_item.hasClass( 'wide' ) ) { 2813 if ( !$menu.hasClass( 'side-menu-columns' ) ) { 2814 popup_obj.style.left = 0; 2815 } 2816 var row_number = 4; 2817 2818 if ( $menu_item.hasClass( 'col-2' ) ) row_number = 2; 2819 if ( $menu_item.hasClass( 'col-3' ) ) row_number = 3; 2820 if ( $menu_item.hasClass( 'col-4' ) ) row_number = 4; 2821 if ( $menu_item.hasClass( 'col-5' ) ) row_number = 5; 2822 if ( $menu_item.hasClass( 'col-6' ) ) row_number = 6; 2823 2824 if ( window.innerWidth < 992 ) 2825 row_number = 1; 2826 2827 var col_length = 0; 2828 $popup.find( '> .inner > ul > li' ).each( function() { 2829 var cols = parseFloat( $( this ).data( 'cols' ) ); 2830 if ( !cols || cols <= 0 ) 2831 cols = 1; 2832 2833 if ( cols > row_number ) 2834 cols = row_number; 2835 2836 col_length += cols; 2837 } ); 2838 2839 if ( col_length > row_number ) col_length = row_number; 2840 2841 var popup_max_width = $popup.data( 'popup-mw' ) ? $popup.data( 'popup-mw' ) : $popup.find( '.inner' ).css( 'max-width' ), 2842 col_width = container_width / row_number; 2843 if ( 'none' !== popup_max_width && popup_max_width < container_width ) { 2844 col_width = parseInt( popup_max_width ) / row_number; 2845 } 2846 2847 $popup.find( '> .inner > ul > li' ).each( function() { 2848 var cols = parseFloat( $( this ).data( 'cols' ) ); 2849 if ( cols <= 0 ) 2850 cols = 1; 2851 2852 if ( cols > row_number ) 2853 cols = row_number; 2854 2855 if ( $menu_item.hasClass( 'pos-center' ) || $menu_item.hasClass( 'pos-left' ) || $menu_item.hasClass( 'pos-right' ) ) 2856 this.style.width = ( 100 / col_length * cols ) + '%'; 2857 else 2858 this.style.width = ( 100 / row_number * cols ) + '%'; 2859 } ); 2860 2861 popup_obj.children[0].children[0].style.width = col_width * col_length + 1 + 'px'; 2862 2863 if ( !$menu.hasClass( 'side-menu-columns' ) ) { 2864 if ( is_right_sidebar ) { 2865 popup_obj.style.left = 'auto'; 2866 popup_obj.style.right = ( this.offsetWidth ? this.offsetWidth : $( this ).width() ) + 'px'; 2867 } else { 2868 popup_obj.style.left = ( this.offsetWidth ? this.offsetWidth : $( this ).width() ) + 'px'; 2869 popup_obj.style.right = 'auto'; 2870 } 2871 } 2872 } 2873 2874 if ( !is_opened ) { 2875 popup_obj.style.display = 'none'; 2876 } 2877 if ( menuobj.classList.contains( 'side-menu-accordion' ) ) { 2878 2879 } else if ( menuobj.classList.contains( 'side-menu-slide' ) ) { 2880 2881 } else if ( !$menu_item.hasClass( 'sub-ready' ) ) { 2882 if ( !( 'ontouchstart' in document ) && window.innerWidth > 991 ) { 2883 $menu_item.on( 'mouseenter', function() { 2884 $menu_items.find( '.popup' ).hide(); 2885 $popup.show(); 2886 $popup.parent().addClass( 'open' ); 2887 //$( document.body ).trigger( 'appear_refresh' ); 2888 2889 if ( !$menu.hasClass( 'side-menu-columns' ) && 'static' !== $popup.parent().css('position') ) { 2890 let _thisTop = this.getBoundingClientRect().top; 2891 2892 if ( this.offsetParent && ( _thisTop + popup_obj.offsetHeight >
2892 theme.innerHeight ) ) { 2893 // let _top = ( popup_obj.offsetHeight - this.offsetHeight ) / 2; 2894 let _top = _thisTop + popup_obj.offsetHeight - theme.innerHeight; 2895 let _top1 = _thisTop - this.parentNode.getBoundingClientRect().top; 2896 if ( _top1 < _top ) { 2897 _top = _top1; 2898 } 2899 popup_obj.style.top = -1 * ( _top ) + 'px'; 2900 popup_obj.style.setProperty( '--porto-sd-menu-popup-top', -1 * ( _top ) + 'px' ); 2901 } else { 2902 popup_obj.style.top = ''; 2903 popup_obj.style.setProperty( '--porto-sd-menu-popup-top', '' ); 2904 } 2905 } 2906 2907 } ).on( 'mouseleave', function() { 2908 $popup.hide(); 2909 $popup.parent().removeClass( 'open' ); 2910 } ); 2911 } else { 2912 $menu_item.on( 'click', '.arrow', function() { 2913 if ( ! $menu.hasClass( 'side-menu-columns' ) && ! $popup.parent().hasClass( 'open' ) && window.innerWidth > 991 ) { 2914 $menus.children( 'li.has-sub' ).removeClass( 'open' ).children( '.popup' ).hide(); 2915 } 2916 $popup.slideToggle(); 2917 $popup.parent().toggleClass( 'open' ); 2918 //$( document.body ).trigger( 'appear_refresh' ); 2919 } ); 2920 } 2921 $menu_item.addClass( 'sub-ready' ); 2922 } 2923 } 2924 } ); 2925 } ); 2926 2927 // slide menu 2928 if ( $menus.hasClass( 'side-menu-slide' ) ) { 2929 var slideNavigation = { 2930 $mainNav: $menus, 2931 $mainNavItem: $menus.find( 'li' ), 2932 2933 build: function() { 2934 var self = this; 2935 2936 self.menuNav(); 2937 }, 2938 initSub: function( $obj ) { 2939 var currentMenu = $obj.closest( 'ul' ), 2940 nextMenu = $obj.parent().find( 'ul' ).first(); 2941 2942 if ( nextMenu.children( '.menu-item' ).children( '.go-back' ).length < 1 ) { 2943 nextMenu.prepend( '<li class="menu-item"><a class="go-back" href="#">' + js_porto_vars.submenu_back + '</a></li>' ); 2944 } 2945 2946 2947 currentMenu.addClass( 'next-menu' ); 2948 2949 nextMenu.addClass( 'visible' ); 2950 currentMenu.css( { 2951 overflow: 'visible', 2952 'overflow-y': 'visible' 2953 } ); 2954 2955 //for (i = 0; i < nextMenu.find('> li').length; i++) { 2956 if ( nextMenu.outerHeight() < ( nextMenu.closest( '.header-main' ).outerHeight() - 100 ) ) { 2957 nextMenu.css( { 2958 height: nextMenu.outerHeight() + nextMenu.find( '> li' ).outerHeight() 2959 } ); 2960 } 2961 // } 2962 2963 var nextMenuHeightDiff = nextMenu.find( '> li' ).length * nextMenu.find( '> li' ).outerHeight() - nextMenu.outerHeight(); 2964 2965 if ( nextMenuHeightDiff > 0 ) { 2966 nextMenu.css( { 2967 overflow: 'hidden', 2968 'overflow-y': 'scroll' 2969 } ); 2970 } 2971 2972 2973 2974 nextMenu.css( { 2975 'padding-top': nextMenuHeightDiff + 'px' 2976 } ); 2977 }, 2978 menuNav: function() { 2979 var self = this; 2980 2981 self.$mainNav.find( '.menu-item-has-children > a.nolink' ).removeClass( 'nolink' ).attr( 'href', '' ); 2982 2983 self.$mainNav.find( '.menu-item-has-children > a:not(.go-back)' ).off( 'click' ).on( 'click', function( e ) { 2984 e.stopImmediatePropagation(); 2985 e.preventDefault(); 2986 var $this = $( this ); 2987 if ( js_porto_vars.lazyload_menu && !self.$mainNav.hasClass( 'sub-ready' ) ) { 2988 self.initSub( $this ); 2989 self.$mainNav.on( 'sub-loaded', function() { 2990 self.initSub( $this ); 2991 } ); 2992 } else { 2993 self.initSub( $this ); 2994 } 2995 } ); 2996 } 2997 }; 2998 2999 slideNavigation.build(); 3000 } 3001 3002 if ( parent_toogle_wrap ) { 3003 parent_toogle_wrap.style.display = ''; 3004 parent_toogle_wrap.style.visibility = ''; 3005 } 3006 3007 return self; 3008 }, 3009 3010 events: function() { 3011 var self = this; 3012 3013 self.$toggle.on( 'click', function() { 3014 var $widget = $( this ).parent().parent(); 3015 var $this = $( this ); 3016 if ( $this.hasClass( 'closed' ) ) { 3017 $this.removeClass( 'closed' ); 3018 $widget.removeClass( 'closed' ); 3019 $widget.find( '.sidebar-menu-wrap' ).stop().slideDown( 400, function() { 3020 $( this ).attr( 'style', '' ).show(); 3021 self.build(); 3022 } ); 3023 } else { 3024 $this.addClass( 'closed' ); 3025 $widget.addClass( 'closed' ); 3026 $widget.find( '.sidebar-menu-wrap' ).stop().slideUp( 400, function() { 3027 $( this ).attr( 'style', '' ).hide(); 3028 } ); 3029 } 3030 } ); 3031 3032 this.$menu_toggle.on( 'click', function() { 3033 var $toggle_menu = $( this ).parent(); 3034 if ( $toggle_menu.hasClass( 'show-always' ) || $toggle_menu.hasClass( 'show-hover' ) ) { 3035 return; 3036 } 3037 var $this = $( this ); 3038 if ( $this.hasClass( 'closed' ) ) { 3039 $this.removeClass( 'closed' ); 3040 $toggle_menu.removeClass( 'closed' ); 3041 $toggle_menu.find( '.toggle-menu-wrap' ).stop().slideDown( 400, function() { 3042 $( this ).attr( 'style', '' ).show(); 3043 } ); 3044 3045 self.build(); 3046 3047 } else { 3048 $this.addClass( 'closed' ); 3049 $toggle_menu.addClass( 'closed' ); 3050 $toggle_menu.find( '.toggle-menu-wrap' ).stop().slideUp( 400, function() { 3051 $( this ).attr( 'style', '' ).hide(); 3052 } ); 3053 } 3054 } ); 3055 3056 if ( self.$menu.hasClass( 'side-menu-slide' ) ) { 3057 self.$menu.on( 'click', '.go-back', function( e ) { 3058 e.preventDefault(); 3059 var prevMenu = $( this ).closest( '.next-menu' ), 3060 prevMenuHeightDiff = 0; 3061 if ( prevMenu.length && prevMenu.find( '> li' ).length ) { 3062 prevMenuHeightDiff = prevMenu.find( '> li' ).length * prevMenu.find( '> li' ).outerHeight() - prevMenu.outerHeight(); 3063 } 3064 3065 3066 3067 3068 prevMenu.removeClass( 'next-menu' ); 3069 $( this ).closest( 'ul' ).removeClass( 'visible' ); 3070 3071 if ( prevMenuHeightDiff > 0 ) { 3072 prevMenu.css( { 3073 overflow: 'hidden', 3074 'overflow-y': 'scroll' 3075 } ); 3076 } 3077 } ); 3078 } 3079 3080 if ( $( '.sidebar-menu:not(.side-menu-accordion)' ).closest( '[data-plugin-sticky]' ).length ) { 3081 var sidebarRefreshTimer; 3082 $( window ).smartresize( function() { 3083 if ( sidebarRefreshTimer ) { 3084 clearTimeout( sidebarRefreshTimer ); 3085 } 3086 sidebarRefreshTimer = setTimeout( function() { 3087 self.build(); 3088 }, 800 ); 3089 } ); 3090 } else { 3091 $( window ).smartresize( function( e ) { 3092 if ( e.originalEvent ) { 3093 self.build(); 3094 } 3095 } ); 3096 } 3097 3098 setTimeout( function() { 3099 self.build(); 3100 }, 400 ); 3101 3102 if ( 'ontouchstart' in document ) { 3103 $( document.body ).on( 'click', function(e) { 3104 if ( window.innerWidth > 991 ) { 3105 if ( ! $( e.target ).closest( 'li.has-sub.open' ).length ) { 3106 self.$menu.each( function() { 3107 var $this = $(this); 3108 if ( $this.hasClass( 'side-menu-accordion' ) || $this.hasClass( 'side-menu-slide' ) || $this.hasClass( 'side-menu-columns' ) ) { 3109 return; 3110 } 3111 3112 $this.children( 'li.has-sub' ).removeClass( 'open' ).children( '.popup' ).hide(); 3113 } ); 3114 } 3115 } 3116 } ); 3117 } 3118 3119 return self; 3120 } 3121 } 3122 3123 } ); 3124 3125} ).apply( this, [window.theme, jQuery] ); 3126 3127// Sticky Header 3128( function( theme, $ ) { 3129 'use strict'; 3130 3131 theme = theme || {}; 3132 3133 $.extend( theme, { 3134 3135 StickyHeader: { 3136 3137 defaults: { 3138 header: $( '#header' ) 3139 }, 3140 3141 initialize: function( $header ) { 3142 this.$header = ( $header || this.defaults.header ); 3143 this.sticky_height = 0; 3144 this.sticky_pos = 0; 3145 this.change_logo = theme.change_logo; 3146 3147 if ( !theme.show_sticky_header || !this.$header.length || $( '.side-header-narrow-bar' ).length ) 3148 return this; 3149 3150 var self = this; 3151 3152 var $menu_wrap = self.$header.find( '> .main-menu-wrap' ); 3153 if ( $menu_wrap.length ) { 3154 self.$menu_wrap = $menu_wrap; 3155 self.menu_height = $menu_wrap.height(); 3156 } else { 3157 self.$menu_wrap = false; 3158 } 3159 3160 self.$header_main = self.$header.find( '.header-main' ); 3161 3162 if ( self.$header_main.length > 1 ) { 3163 self.$header_main = $( self.$header_main[0] ); 3164 } 3165 3166 // fix compatibility issue with Elementor pro header builder 3167 if ( !self.$header_main.length && self.$header.children( '.elementor-location-header' ).length ) { 3168 self.$header_main = self.$header.children( '.elementor-location-header' ).last().addClass( 'header-main' ); 3169 } 3170 3171 if ( !self.$header_main.length ) { 3172 return this; 3173 } 3174 3175 self.reveal = self.$header.parents( '.header-wrapper' ).hasClass( 'header-reveal' ); 3176
3177 self.is_sticky = false; 3178 3179 self.reset() 3180 .build() 3181 .events(); 3182 3183 return self; 3184 }, 3185 3186 build: function() { 3187 var self = this; 3188 3189 if ( !self.is_sticky && ( window.innerHeight + self.header_height + theme.adminBarHeight() + parseInt( self.$header.css( 'border-top-width' ) ) >= $( document ).height() ) ) { 3190 return self; 3191 } 3192 3193 if ( window.innerHeight > $( document.body ).height() ) 3194 window.scrollTo( 0, 0 ); 3195 3196 var scroll_top = $( window ).scrollTop(), 3197 $pageWrapper = $( '.page-wrapper' ); 3198 3199 if ( self.$menu_wrap && !theme.isTablet() ) { 3200 3201 self.$header_main.stop().css( 'top', 0 ); 3202 3203 if ( self.$header.parent().hasClass( 'fixed-header' ) ) 3204 self.$header.parent().attr( 'style', '' ); 3205 3206 // Scroll Up - Header Type 3207 if ( $( '.page-wrapper' ).hasClass( 'sticky-scroll-up' ) ) { 3208 scroll_top -= self.sticky_height; 3209 if ( scroll_top > self.sticky_pos + 100 ) { 3210 self.$header.addClass( 'sticky-ready' ); 3211 } else { 3212 self.$header.removeClass( 'sticky-ready' ); 3213 } 3214 } 3215 if ( scroll_top > self.sticky_pos ) { 3216 if ( !self.$header.hasClass( 'sticky-header' ) && ( ! $pageWrapper.hasClass( 'sticky-scroll-up' ) || ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && 'undefined' !== typeof ( $pageWrapper.data( 'prev-scrollpos' ) ) ) ) ) { 3217 var header_height = self.$header.outerHeight(); 3218 self.$header.addClass( 'sticky-header' ).css( 'height', header_height ); 3219 self.$menu_wrap.stop().css( 'top', theme.adminBarHeight() ); 3220 3221 var selectric = self.$header.find( '.header-main .searchform select' ).data( 'selectric' ); 3222 if ( selectric && typeof selectric.close != 'undefined' ) 3223 selectric.close(); 3224 3225 if ( self.$header.parent().hasClass( 'fixed-header' ) ) { 3226 self.$header_main.hide(); 3227 self.$header.css( 'height', '' ); 3228 } 3229 3230 if ( !self.init_toggle_menu ) { 3231 self.init_toggle_menu = true; 3232 theme.MegaMenu.build(); 3233 if ( $( '#main-toggle-menu' ).length ) { 3234 if ( $( '#main-toggle-menu' ).hasClass( 'show-always' ) ) { 3235 $( '#main-toggle-menu' ).data( 'show-always', true ); 3236 $( '#main-toggle-menu' ).removeClass( 'show-always' ); 3237 } 3238 $( '#main-toggle-menu' ).addClass( 'closed' ); 3239 $( '#main-toggle-menu .menu-title' ).addClass( 'closed' ); 3240 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 3241 } 3242 } 3243 self.is_sticky = true; 3244 } 3245 } else { 3246 if ( self.$header.hasClass( 'sticky-header' ) ) { 3247 self.$header.removeClass( 'sticky-header' ); 3248 self.$header.css( 'height', '' ); 3249 self.$menu_wrap.stop().css( 'top', 0 ); 3250 self.$header_main.show(); 3251 3252 var selectric = self.$header.find( '.main-menu-wrap .searchform select' ).data( 'selectric' ); 3253 if ( selectric && typeof selectric.close != 'undefined' ) 3254 selectric.close(); 3255 3256 if ( self.init_toggle_menu ) { 3257 self.init_toggle_menu = false; 3258 theme.MegaMenu.build(); 3259 if ( $( '#main-toggle-menu' ).length ) { 3260 if ( $( '#main-toggle-menu' ).data( 'show-always' ) ) { 3261 $( '#main-toggle-menu' ).addClass( 'show-always' ); 3262 $( '#main-toggle-menu' ).removeClass( 'closed' ); 3263 $( '#main-toggle-menu .menu-title' ).removeClass( 'closed' ); 3264 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 3265 } 3266 } 3267 } 3268 self.is_sticky = false; 3269 } 3270 } 3271 } else { 3272 self.$header_main.show(); 3273 if ( self.$header.parent().hasClass( 'fixed-header' ) && $( '#wpadminbar' ).length && $( '#wpadminbar' ).css( 'position' ) == 'absolute' ) { 3274 self.$header.parent().css( 'top', ( $( '#wpadminbar' ).height() - scroll_top ) < 0 ? -$( '#wpadminbar' ).height() : -scroll_top ); 3275 } else if ( self.$header.parent().hasClass( 'fixed-header' ) ) { 3276 self.$header.parent().attr( 'style', '' ); 3277 } else { 3278 if ( self.$header.parent().hasClass( 'fixed-header' ) ) 3279 self.$header.parent().attr( 'style', '' ); 3280 } 3281 if ( self.$header.hasClass( 'sticky-menu-header' ) && !theme.isTablet() ) {
3282 self.$header_main.stop().css( 'top', 0 ); 3283 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 3284 self.$header_main.removeClass( 'sticky' ); 3285 self.$header.removeClass( 'sticky-header' ); 3286 self.is_sticky = false; 3287 self.sticky_height = 0; 3288 } else { 3289 if ( self.$menu_wrap ) 3290 self.$menu_wrap.stop().css( 'top', 0 ); 3291 if ( $pageWrapper.hasClass( 'sticky-scroll-up' ) ) { 3292 scroll_top -= self.sticky_height; 3293 if ( scroll_top > self.sticky_pos + 100 ) { 3294 self.$header.addClass( 'sticky-ready' ); 3295 } else { 3296 self.$header.removeClass( 'sticky-ready' ); 3297 } 3298 } 3299 if ( scroll_top > self.sticky_pos && ( !theme.isTablet() || ( theme.isTablet() && ( !theme.isMobile() && theme.show_sticky_header_tablet ) || ( theme.isMobile() && theme.show_sticky_header_tablet && theme.show_sticky_header_mobile ) ) ) ) { 3300 if ( ! self.$header.hasClass( 'sticky-header' ) && ( ! $pageWrapper.hasClass( 'sticky-scroll-up' ) || ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && 'undefined' !== typeof ( $pageWrapper.data( 'prev-scrollpos' ) ) ) ) ) { 3301 var header_height = self.$header.outerHeight(); 3302 self.$header.addClass( 'sticky-header' ).css( 'height', header_height ); 3303 self.$header_main.addClass( 'sticky' ); 3304 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' ); 3305 self.$header_main.stop().css( 'top', theme.adminBarHeight() ); 3306 3307 if ( !self.init_toggle_menu ) { 3308 self.init_toggle_menu = true; 3309 theme.MegaMenu.build(); 3310 if ( $( '#main-toggle-menu' ).length ) { 3311 if ( $( '#main-toggle-menu' ).hasClass( 'show-always' ) ) { 3312 $( '#main-toggle-menu' ).data( 'show-always', true ); 3313 $( '#main-toggle-menu' ).removeClass( 'show-always' ); 3314 } 3315 $( '#main-toggle-menu' ).addClass( 'closed' ); 3316 $( '#main-toggle-menu .menu-title' ).addClass( 'closed' ); 3317 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 3318 } 3319 } 3320 self.is_sticky = true; 3321 } 3322 } else { 3323 if ( self.$header.hasClass( 'sticky-header' ) ) { 3324 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 3325 self.$header_main.removeClass( 'sticky' ); 3326 self.$header.removeClass( 'sticky-header' ); 3327 self.$header.css( 'height', '' ); 3328 self.$header_main.stop().css( 'top', 0 ); 3329 3330 if ( self.init_toggle_menu ) { 3331 self.init_toggle_menu = false; 3332 theme.MegaMenu.build(); 3333 if ( $( '#main-toggle-menu' ).length ) { 3334 if ( $( '#main-toggle-menu' ).data( 'show-always' ) ) { 3335 $( '#main-toggle-menu' ).addClass( 'show-always' ); 3336 $( '#main-toggle-menu' ).removeClass( 'closed' ); 3337 $( '#main-toggle-menu .menu-title' ).removeClass( 'closed' ); 3338 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 3339 } 3340 } 3341 } 3342 self.is_sticky = false; 3343 } 3344 } 3345 } 3346 } 3347 3348 if ( !self.$header.hasClass( 'header-loaded' ) ) 3349 self.$header.addClass( 'header-loaded' ); 3350 3351 if ( !self.$header.find( '.logo' ).hasClass( 'logo-transition' ) ) 3352 self.$header.find( '.logo' ).addClass( 'logo-transition' ); 3353 3354 if ( self.$header.find( '.overlay-logo' ).get( 0 ) && !self.$header.find( '.overlay-logo' ).hasClass( 'overlay-logo-transition' ) ) 3355 self.$header.find( '.overlay-logo' ).addClass( 'overlay-logo-transition' ); 3356 3357 return self; 3358 }, 3359 3360 reset: function() { 3361 var self = this; 3362 3363 if ( self.$header.find( '.logo' ).hasClass( 'logo-transition' ) ) 3364 self.$header.find( '.logo' ).removeClass( 'logo-transition' ); 3365 3366 if ( self.$header.find( '.overlay-logo' ).get( 0 ) && self.$header.find( '.overlay-logo' ).hasClass( 'overlay-logo-transition' ) ) 3367 self.$header.find( '.overlay-logo' ).removeClass( 'overlay-logo-transition' ); 3368 3369 if ( self.$menu_wrap && !theme.isTablet() ) { 3370 // show main menu 3371 self.$header.addClass( 'sticky-header sticky-header-calc' ); 3372 self.$header_main.addClass( 'sticky' ); 3373 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' ); 3374 self.sticky_height = self.$menu_wrap.height() + parseInt( self.$menu_wrap.css( 'padding-top' ) ) + parseInt( self.$menu_wrap.css( 'padding-bottom' ) ); 3375 3376 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 3377 self.$header_main.removeClass( 'sticky' ); 3378 self.$header.removeClass( 'sticky-header sticky-header-calc' ); 3379 self.header_height = self.$header.height() + parseInt( self.$header.css( 'margin-top' ) ); 3380 self.menu_height = self.$menu_wrap.height() + parseInt( self.$menu_wrap.css( 'padding-top' ) ) + parseInt( self.$menu_wrap.css( 'padding-bottom' ) ); 3381 3382 self.sticky_pos = ( self.header_height - self.sticky_height ) + parseInt( $( 'body' ).css( 'padding-top' ) ) + parseInt( self.$header.css( 'border-top-width' ) ); 3383 if ( $( '.banner-before-header' ).length ) { 3384 self.sticky_pos += $( '.banner-before-header' ).height(); 3385 } 3386 if ( $( '.porto-block-html-top' ).length ) { 3387 self.sticky_pos += $( '.porto-block-html-top' ).height(); 3388 } 3389 } else { 3390 // show header main 3391 self.$header.addClass( 'sticky-header sticky-header-calc' ); 3392 self.$header_main.addClass( 'sticky' ); 3393 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' ); 3394 self.sticky_height = self.$header_main.outerHeight(); 3395 3396 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 3397 self.$header_main.removeClass( 'sticky' ); 3398 self.$header.removeClass( 'sticky-header sticky-header-calc' ); 3399 self.header_height = self.$header.height() + parseInt( self.$header.css( 'margin-top' ) ); 3400 self.main_height = self.$header_main.height(); 3401 3402 if ( !( !theme.isTablet() || ( theme.isTablet() && !theme.isMobile() && theme.show_sticky_header_tablet ) || ( theme.isMobile() && theme.show_sticky_header_tablet && theme.show_sticky_header_mobile ) ) ) { 3403 self.sticky_height = 0; 3404 } 3405 3406 /*if (self.$header_main.length && self.$header.length) { 3407 self.sticky_pos = self.$header_main.offset().top - self.$header.offset().top + $('.banner-before-header').height() + parseInt($('body').css('padding-top')) + parseInt(self.$header.css('border-top-width')); 3408 } else { 3409 self.sticky_pos = $('.banner-before-header').height() + parseInt($('body').css('padding-top')) + parseInt(self.$header.css('border-top-width')); 3410 } 3411 if (theme.adminBarHeight() && self.$header.offset().top > theme.adminBarHeight()) { 3412 self.sticky_pos -= theme.adminBarHeight(); 3413 } 3414 self.sticky_pos = (self.header_height - self.sticky_height) + $('.banner-before-header').height() + $('.porto-block-html-top').height() + parseInt($('body').css('padding-top')) + parseInt(self.$header.css('border-top-width'));*/ 3415 self.sticky_pos = self.$header.offset().top + self.header_height - self.sticky_height - theme.adminBarHeight() + parseInt( self.$header.css( 'border-top-width' ) ); 3416 } 3417 3418 if ( self.reveal ) { 3419 if ( self.menu_height ) { 3420 self.sticky_pos += self.menu_height + 30; 3421 } else { 3422 self.sticky_pos += 30; 3423 } 3424 } 3425 3426 if ( self.sticky_pos < 0 ) { 3427 self.sticky_pos = 0; 3428 } 3429 3430 self.init_toggle_menu = false; 3431 3432 self.$header_main.removeAttr( 'style' ); 3433 if ( !theme.isTablet() && self.$header.hasClass( 'header-side' ) && typeof self.$header.attr( 'data-
3433plugin-sticky' ) != 'undefined' ) { 3434 self.$header.css( 'height', '' ); 3435 } else { 3436 self.$header.removeAttr( 'style' ); 3437 } 3438 return self; 3439 }, 3440 3441 events: function() { 3442 var self = this, win_width = 0; 3443 3444 $( window ).smartresize( function() { 3445 if ( win_width != window.innerWidth ) { 3446 self.reset().build(); 3447 win_width = window.innerWidth; 3448 } 3449 } ); 3450 3451 var scrollEffect = function () { 3452 theme.requestFrame( function() { 3453 self.build(); 3454 var $pageWrapper = $( '.page-wrapper' ); 3455 if ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && ! $( 'html' ).hasClass( 'porto-search-opened' ) ) { 3456 var prevScrollPos = 0, 3457 scrollTop = $( window ).scrollTop(); 3458 if ( $pageWrapper.data( 'prev-scrollpos' ) ) { 3459 prevScrollPos = $pageWrapper.data( 'prev-scrollpos' ); 3460 } 3461 if ( scrollTop >= prevScrollPos ) { 3462 self.$header.addClass( 'scroll-down' ); 3463 } else { 3464 self.$header.removeClass( 'scroll-down' ); 3465 } 3466 $pageWrapper.data( 'prev-scrollpos', scrollTop ); 3467 } 3468 } ); 3469 } 3470 3471 window.addEventListener( 'scroll', scrollEffect, { passive: true } ); 3472 scrollEffect(); 3473 return self; 3474 } 3475 } 3476 3477 } ); 3478 3479} ).apply( this, [window.theme, jQuery] ); 3480 3481// Side Nav 3482( function( theme, $ ) { 3483 'use strict'; 3484 3485 theme = theme || {}; 3486 3487 $.extend( theme, { 3488 3489 SideNav: { 3490 3491 defaults: { 3492 side_nav: $( '.header-side-nav #header' ) 3493 }, 3494 3495 bc_pos_top: 0, 3496 3497 initialize: function( $side_nav ) { 3498 this.$side_nav = ( $side_nav || this.defaults.side_nav ); 3499 3500 if ( !this.$side_nav.length ) 3501 return this; 3502 3503 var self = this; 3504 3505 self.$side_nav.addClass( 'initialize' ); 3506 3507 self.reset() 3508 .build() 3509 .events(); 3510 3511 return self; 3512 }, 3513 3514 build: function() { 3515 var self = this; 3516 3517 var $page_top = $( '.page-top' ),
3518 $main = $( '#main' ); 3519 3520 if ( theme.isTablet() ) { 3521 //self.$side_nav.removeClass("fixed-bottom"); 3522 $page_top.removeClass( "fixed-pos" ); 3523 $page_top.attr( 'style', '' ); 3524 $main.attr( 'style', '' ); 3525 } else { 3526 //var side_height = self.$side_nav.innerHeight(); 3527 //var window_height = window.innerHeight; 3528 var scroll_top = $( window ).scrollTop(); 3529 3530 /*if (side_height - window_height + theme.adminBarHeight() < scroll_top) { 3531 if (!self.$side_nav.hasClass("fixed-bottom")) 3532 self.$side_nav.addClass("fixed-bottom"); 3533 } else { 3534 if (self.$side_nav.hasClass("fixed-bottom")) 3535 self.$side_nav.removeClass("fixed-bottom"); 3536 }*/ 3537 3538 if ( $page_top.length && $page_top.outerHeight() < 100 && !$( '.side-header-narrow-bar-top' ).length ) { 3539 if ( self.page_top_offset == theme.adminBarHeight() || self.page_top_offset <= scroll_top ) { 3540 if ( !$page_top.hasClass( "fixed-pos" ) ) { 3541 $page_top.addClass( "fixed-pos" ); 3542 $page_top.css( 'top', theme.adminBarHeight() ); 3543 $main.css( 'padding-top', $page_top.outerHeight() ); 3544 } 3545 } else { 3546 if ( $page_top.hasClass( "fixed-pos" ) ) { 3547 $page_top.removeClass( "fixed-pos" ); 3548 $page_top.attr( 'style', '' ); 3549 $main.attr( 'style', '' ); 3550 } 3551 } 3552 } 3553 $main.css( 'min-height', window.innerHeight - theme.adminBarHeight() - $( '.page-top:not(.fixed-pos)' ).height() - $( '.footer-wrapper' ).height() ); 3554 } 3555 3556 return self; 3557 }, 3558 3559 reset: function() { 3560 var self = this; 3561 3562 if ( theme.isTablet() ) { 3563 3564 self.$side_nav.attr( 'style', '' ); 3565 3566 } else { 3567 3568 var w_h = window.innerHeight, 3569 $side_bottom = self.$side_nav.find( '.side-bottom' ); 3570 3571 self.$side_nav.css( { 3572 'min-height': w_h - theme.adminBarHeight(), 3573 'padding-bottom': $side_bottom.length ? $side_bottom.height() + parseInt( $side_bottom.css( 'margin-top' ) ) + parseInt( $side_bottom.css( 'margin-bottom' ) ) : '' 3574 } ); 3575 3576 var appVersion = navigator.appVersion; 3577 var webkitVersion_positionStart = appVersion.indexOf( "AppleWebKit/" ) + 12; 3578 var webkitVersion_positionEnd = webkitVersion_positionStart + 3; 3579 var webkitVersion = appVersion.slice( webkitVersion_positionStart, webkitVersion_positionEnd ); 3580 if ( webkitVersion < 537 ) { 3581 self.$side_nav.css( '-webkit-backface-visibility', 'hidden' ); 3582 self.$side_nav.css( '-webkit-perspective', '1000' ); 3583 } 3584 } 3585 3586 var $page_top = $( '.page-top' ),
3587 $main = $( '#main' ); 3588 3589 if ( $page_top.length ) { 3590 $page_top.removeClass( "fixed-pos" ); 3591 $page_top.attr( 'style', '' ); 3592 $main.attr( 'style', '' ); 3593 self.page_top_offset = $page_top.offset().top; 3594 } 3595 3596 return self; 3597 }, 3598 3599 events: function() { 3600 var self = this; 3601 3602 $( window ).on( 'resize', function() { 3603 self.reset() 3604 .build(); 3605 } ); 3606 3607 window.addEventListener( 'scroll', function() { 3608 self.build(); 3609 }, { passive: true } ); 3610 3611 if ( $( '.side-header-narrow-bar-top' ).length ) { 3612 if ( $( window ).scrollTop() > theme.adminBarHeight() + $( '.side-header-narrow-bar-top' ).height() ) { 3613 $( '.side-header-narrow-bar-top' ).addClass( 'side-header-narrow-bar-sticky' ); 3614 } 3615 window.addEventListener( 'scroll', function() { 3616 var scroll_top = $( this ).scrollTop(); 3617 if ( scroll_top > theme.adminBarHeight() + $( '.side-header-narrow-bar-top' ).height() ) { 3618 $( '.side-header-narrow-bar-top' ).addClass( 'side-header-narrow-bar-sticky' ); 3619 } else { 3620 $( '.side-header-narrow-bar-top' ).removeClass( 'side-header-narrow-bar-sticky' ); 3621 } 3622 }, { passive: true } ); 3623 } 3624 3625 // Side Narrow Bar 3626 $( '.side-header-narrow-bar .hamburguer-btn' ).on( 'click', function() { 3627 $( this ).toggleClass( 'active' ); 3628 $( '#header' ).toggleClass( 'side-header-visible' ); 3629 if ( $( this ).closest( '.side-header-narrow-bar-top' ).length && !$( '#header > .hamburguer-btn' ).length ) { 3630 $( this ).closest( '.side-header-narrow-bar-top' ).toggle(); 3631 } 3632 } ); 3633 $( '.hamburguer-close' ).on( 'click', function() { 3634 $( '.side-header-narrow-bar .hamburguer-btn' ).trigger( 'click' ); 3635 } ); 3636 3637 return self; 3638 } 3639 } 3640 3641 } ); 3642 3643} ).apply( this, [window.theme, jQuery] ); 3644 3645 3646// Hash Scroll 3647( function( theme, $ ) { 3648 'use strict'; 3649 3650 theme = theme || {}; 3651 3652 $.extend( theme, { 3653 3654 HashScroll: { 3655 3656 initialize: function() { 3657 3658 this.build() 3659 .events(); 3660 3661 return this; 3662 }, 3663 3664 build: function() { 3665 var self = this; 3666 3667 try { 3668 var hash = window.location.hash; 3669 var target = $( hash ); 3670 if ( target.length && !( hash == '#review_form' || hash == '#reviews' || hash.indexOf( '#comment-' ) != -1 ) ) { 3671 $( 'html, body' ).delay( 600 ).stop().animate( { 3672 scrollTop: target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1 3673 }, 600, 'easeOutQuad' ); 3674 } 3675 3676 return self; 3677 } catch ( err ) { 3678 return self; 3679 } 3680 }, 3681 3682 getTarget: function( href ) { 3683 if ( '#' == href || href.endsWith( '#' ) ) { 3684 return false; 3685 } 3686 var target; 3687 3688 if ( href.indexOf( '#' ) == 0 ) { 3689 target = $( href ); 3690 } else { 3691 var url = window.location.href; 3692 url = url.substring( url.indexOf( '://' ) + 3 ); 3693 if ( url.indexOf( '#' ) != -1 ) 3694 url = url.substring( 0, url.indexOf( '#' ) ); 3695 href = href.substring( href.indexOf( '://' ) + 3 ); 3696 href = href.substring( href.indexOf( url ) + url.length ); 3697 if ( href.indexOf( '#' ) == 0 ) { 3698 target = $( href ); 3699 } 3700 } 3701 return target; 3702 }, 3703 3704 activeMenuItem: function() { 3705 var self = this; 3706 3707 var scroll_pos = $( window ).scrollTop(); 3708 3709 var $menu_items = $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"]' ); 3710 if ( $menu_items.length ) { 3711 $menu_items.each( function() { 3712 var $this = $( this ), 3713 href = $this.attr( 'href' ), 3714 target = self.getTarget( href ); 3715 if ( target && target.get( 0 ) ) { 3716 if ( $this.parent().is( ':last-child' ) && scroll_pos + window.innerHeight >= target.offset().top + target.outerHeight() ) { 3717 $this.parent().siblings().removeClass( 'active' ); 3718 $this.parent().addClass( 'active' ); 3719 } else { 3720 var scroll_to = target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1, 3721 $parent = $this.parent(); 3722 //if (scroll_to <= theme.StickyHeader.sticky_pos + theme.sticky_nav_height) { 3723 //scroll_to = theme.StickyHeader.sticky_pos + theme.sticky_nav_height + 1; 3724 //} 3725 if ( scroll_to <= scroll_pos + 5 ) { 3726 $parent.siblings().removeClass( 'active' ); 3727 $parent.addClass( 'active' ); 3728 if ( $parent.closest( '.secondary-menu' ).length ) { 3729 $parent.closest( '#header' ).find( '.main-menu' ).eq( 0 ).children( '.menu-item.active' ).removeClass( 'active' ); 3730 } 3731 } else { 3732 $parent.removeClass( 'active' ); 3733 } 3734 } 3735 } 3736 } ); 3737 } 3738 3739 return self; 3740 }, 3741 3742 events: function() { 3743 var self = this; 3744 3745 $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"], a[href*="#"].hash-scroll, .hash-scroll-wrap a[href*="#"]' ).on( 'click', function( e ) { 3746 e.preventDefault(); 3747 3748 var $this = $( this ), 3749 href = $this.attr( 'href' ), 3750 target = self.getTarget( href ); 3751 3752 if ( target && target.get( 0 ) ) { 3753 var $parent = $this.parent(); 3754 3755 var scroll_to = target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1; 3756 // if (scroll_to <= theme.StickyHeader.sticky_pos + theme.sticky_nav_height) { 3757 // scroll_to = theme.StickyHeader.sticky_pos + theme.sticky_nav_height + 1; 3758 // } 3759 $( 'html, body' ).stop().animate( { 3760 scrollTop: scroll_to 3761 }, 600, 'easeOutQuad', function() { 3762 //self.activeMenuItem(); 3763 $parent.siblings().removeClass( 'active' ); 3764 $parent.addClass( 'active' ); 3765 } ); 3766 if ( $this.closest( '.porto-popup-menu.opened' ).length ) { 3767 $this.closest( '.porto-popup-menu.opened' ).children( '.hamburguer-btn' ).trigger( 'click' ); 3768 } 3769 } else if ( ( '#' != href || !$this.closest( '.porto-popup-menu.opened' ).length ) && !$this.hasClass( 'nolink' ) ) { 3770 window.location.href = $this.attr( 'href' ); 3771 } 3772 } ); 3773 3774 /*window.addEventListener( 'scroll', function () { 3775 self.activeMenuItem(); 3776 }, { passive: true } );*/ 3777 var $menu_items = $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"]' ); 3778 $menu_items.each( function() {
3779 var rootMargin = '-20% 0px -79.9% 0px', 3780 isLast = $( this ).parent().is( ':last-child' ); 3781 if ( isLast ) { 3782 var obj = document.getElementById( this.hash.replace( '#', '' ) ); 3783 if ( obj && document.body.offsetHeight - obj.offsetTop < window.innerHeight ) { 3784 var ratio = ( window.innerHeight - document.body.offsetHeight + obj.offsetTop ) / window.innerHeight * 0.8; 3785 ratio = Math.round( ratio * 100 ); 3786 rootMargin = '-' + ( 20 + ratio ) + '% 0px -' + ( 79.9 - ratio ) + '% 0px'; 3787 } 3788 } 3789 var callback = function() { 3790 if ( this && typeof this[0] != 'undefined' && this[0].id ) { 3791 $( '.menu-item > a[href*="#' + this[0].id + '"], .porto-sticky-nav .nav > li > a[href*="#' + this[0].id + '"]' ).parent().addClass( 'active' ).siblings().removeClass( 'active' ); 3792 } 3793 }; 3794 self.scrollSpyIntObs( this.hash, callback, { 3795 rootMargin: rootMargin, 3796 thresholds: 0 3797 }, true, isLast, true, $menu_items, $( this ).parent().index() ); 3798 } ); 3799 3800 //self.activeMenuItem(); 3801 3802 return self; 3803 }, 3804 3805 scrollSpyIntObs: function( selector, functionName, intObsOptions, al
3805waysObserve, isLast, firstLoad, $allItems, index ) { 3806 if ( typeof IntersectionObserver == 'undefined' ) { 3807 return this; 3808 } 3809 var obj = document.getElementById( selector.replace( '#', '' ) ); 3810 if ( !obj ) { 3811 return this; 3812 } 3813 3814 var self = this; 3815 3816 var intersectionObserverOptions = { 3817 rootMargin: '0px 0px 200px 0px' 3818 } 3819 3820 if ( Object.keys( intObsOptions ).length ) { 3821 intersectionObserverOptions = $.extend( intersectionObserverOptions, intObsOptions ); 3822 } 3823 3824 var observer = new IntersectionObserver( function( entries ) { 3825 3826 for ( var i = 0; i < entries.length; i++ ) { 3827 var entry = entries[i]; 3828 if ( entry.intersectionRatio > 0 ) { 3829 if ( typeof functionName === 'string' ) { 3830 var func = Function( 'return ' + functionName )(); 3831 } else { 3832 var callback = functionName; 3833 3834 callback.call( $( entry.target ) ); 3835 } 3836 } else { 3837 if ( firstLoad == false ) { 3838 if ( isLast && ! $allItems.closest('.porto-sticky-nav').length ) { 3839 $allItems.filter( '[href*="' + entry.target.id + '"]' ).parent().prev().addClass( 'active' ).siblings().removeClass( 'active' ); 3840 } 3841 } 3842 firstLoad = false; 3843 3844 } 3845 } 3846 }, intersectionObserverOptions ); 3847 3848 observer.observe( obj ); 3849 3850 return this; 3851 } 3852 } 3853 3854 } ); 3855 3856} ).apply( this, [window.theme, jQuery] ); 3857 3858// Float Element 3859( function( theme, $ ) { 3860 3861 'use strict'; 3862 3863 theme = theme || {}; 3864 3865 var instanceName = '__floatElement'; 3866 3867 var PluginFloatElement = function( $el, opts ) { 3868 return this.initialize( $el, opts ); 3869 }; 3870 3871 PluginFloatElement.defaults = { 3872 startPos: 'top', 3873 speed: 3, 3874 horizontal: false, 3875 circle: false, 3876 transition: false, 3877 transitionDelay: 0, 3878 transitionDuration: 500 3879 }; 3880 3881 PluginFloatElement.prototype = { 3882 initialize: function( $el, opts ) { 3883 if ( $el.data( instanceName ) ) { 3884 return this; 3885 } 3886 3887 this.$el = $el; 3888 3889 this 3890 .setData() 3891 .setOptions( opts ) 3892 .build(); 3893 3894 return this; 3895 }, 3896 3897 setData: function() { 3898 this.$el.data( instanceName, this ); 3899 3900 return this; 3901 }, 3902 3903 setOptions: function( opts ) { 3904 this.options = $.extend( true, {}, PluginFloatElement.defaults, opts, { 3905 wrapper: this.$el 3906 } ); 3907 3908 return this; 3909 }, 3910 3911 build: function() { 3912 var self = this, 3913 $el = this.options.wrapper, 3914 $window = $( window ), 3915 minus; 3916 3917 if ( self.options.style ) { 3918 $el.attr( 'style', self.options.style ); 3919 } 3920 3921 if ( self.options.circle ) { 3922 // Set Transition 3923 if ( self.options.transition ) { 3924 $el.css( { 3925 transition: 'ease-out transform ' + self.options.transitionDuration + 'ms ' + self.options.transitionDelay + 'ms' 3926 } ); 3927 } 3928 // Scroll 3929 window.addEventListener( 'scroll', function() { 3930 self.movement( minus ); 3931 }, { passive: true } ); 3932 3933 } else if ( $window.width() > 767 ) { 3934 // Set Start Position 3935 if ( self.options.startPos == 'none' ) { 3936 minus = ''; 3937 } else if ( self.options.startPos == 'top' ) { 3938 $el.css( { 3939 top: 0 3940 } ); 3941 minus = ''; 3942 } else { 3943 $el.css( { 3944 bottom: 0 3945 } ); 3946 minus = '-'; 3947 } 3948 3949 // Set Transition 3950 if ( self.options.transition ) { 3951 $el.css( { 3952 transition: 'ease-out transform ' + self.options.transitionDuration + 'ms ' + self.options.transitionDelay + 'ms' 3953 } ); 3954 } 3955 3956 // First Load 3957 self.movement( minus ); 3958 // Scroll 3959 window.addEventListener( 'scroll', function() { 3960 self.movement( minus ); 3961 }, { passive: true } ); 3962 if ( theme.locomotiveScroll ) { 3963 theme.locomotiveScroll.on( 'scroll', function( instance ) { 3964 self.movement( minus, instance.scroll.y ); 3965 } ); 3966 } 3967 } 3968 3969 return this; 3970 }, 3971 3972 movement: function( minus, isLocomotive = false ) { 3973 var self = this, 3974 $el = this.options.wrapper, 3975 $window = $( window ), 3976 scrollTop = isLocomotive === false ? $window.scrollTop() : isLocomotive, 3977 elementOffset = $el.offset().top, 3978 currentElementOffset = ( elementOffset - scrollTop ); 3979 if ( isLocomotive !== false ) { 3980 currentElementOffset = $el.offset().top; 3981 elementOffset = currentElementOffset + scrollTop; 3982 } 3983 if ( self.options.circle ) { 3984 $el.css( { 3985 transform: 'rotate(' + ( scrollTop * 0.25 ) + 'deg)' 3986 } ); 3987 } else { 3988 var scrollPercent = 100 * currentElementOffset / ( $window.height() ); 3989 3990 if ( elementOffset + $el.height() >= scrollTop && elementOffset <= scrollTop + window.innerHeight ) { 3991 3992 if ( !self.options.horizontal ) { 3993 3994 $el.css( { 3995 transform: 'translate3d(0, ' + minus + scrollPercent / self.options.speed + '%, 0)' 3996 } ); 3997 3998 } else { 3999 4000 $el.css( {
4001 transform: 'translate3d(' + minus + scrollPercent / self.options.speed + '%, 0, 0)' 4002 } ); 4003 4004 } 4005 } 4006 } 4007 } 4008 }; 4009 4010 // expose to scope 4011 $.extend( theme, { 4012 PluginFloatElement: PluginFloatElement 4013 } ); 4014 4015 // jquery plugin 4016 $.fn.themePluginFloatElement = function( opts ) { 4017 return this.map( function() { 4018 var $this = $( this ); 4019 4020 if ( $this.data( instanceName ) ) { 4021 return $this.data( instanceName ); 4022 } else { 4023 return new PluginFloatElement( $this, opts ); 4024 } 4025 4026 } ); 4027 } 4028 4029} ).apply( this, [window.theme, jQuery] ); 4030 4031 4032// Init Theme 4033function porto_init( $wrap ) { 4034 'use strict'; 4035 jQuery( window ).on( 'touchstart', function() { } ); 4036 if ( !$wrap ) { 4037 $wrap = jQuery( document.body ); 4038 } 4039 var wrapObj = $wrap.get( 0 ); 4040 $wrap.trigger( 'porto_init_start', [wrapObj] ); 4041 4042 ( function( $ ) { 4043 // Accordion 4044 if ( $.fn.themeAccordion ) { 4045 4046 $( function() { 4047 $wrap.find( '.accordion:not(.manual)' ).each( function() { 4048 var $this = $( this ), 4049 opts; 4050 4051 var pluginOptions = $this.data( 'plugin-options' ); 4052 if ( pluginOptions ) 4053 opts = pluginOptions; 4054 4055 $this.themeAccordion( opts ); 4056 } ); 4057 } ); 4058 } 4059 4060 // Accordion Menu 4061 if ( $.fn.themeAccordionMenu ) { 4062 4063 $( function() { 4064 $wrap.find( '.accordion-menu:not(.manual)' ).each( function() { 4065 var $this = $( this ), 4066 opts; 4067 4068 var pluginOptions = $this.data( 'plugin-options' ); 4069 if ( pluginOptions ) 4070 opts = pluginOptions; 4071 4072 $this.themeAccordionMenu( opts ); 4073 } ); 4074 } ); 4075 4076 } 4077 4078 // Fit Video 4079 if ( $.fn.themeFitVideo ) { 4080 4081 $( function() { 4082 $wrap.find( '.fit-video:not(.manual)' ).each( function() { 4083 var $this = $( this ), 4084 opts; 4085 4086 var pluginOptions = $this.data( 'plugin-options' ); 4087 if ( pluginOptions ) 4088 opts = pluginOptions; 4089 4090 $this.themeFitVideo( opts ); 4091 } ); 4092 } ); 4093 4094 } 4095 4096 // Video Background 4097 if ( $.fn.themePluginVideoBackground ) { 4098 4099 $( function() { 4100 $wrap.find( '[data-plugin-video-background]:not(.manual)' ).each( function() { 4101 var $this = $( this ), 4102 opts; 4103 4104 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 4105 if ( pluginOptions ) 4106 opts = pluginOptions; 4107 4108 $this.themePluginVideoBackground( opts ); 4109 } ); 4110 } ); 4111 4112 } 4113 4114 // Flickr Zoom 4115 if ( $.fn.themeFlickrZoom ) { 4116 4117 $( function() { 4118 $wrap.find( '.wpb_flickr_widget:not(.manual)' ).each( function() { 4119 var $this = $( this ), 4120 opts; 4121 4122 var pluginOptions = $this.data( 'plugin-options' ); 4123 if ( pluginOptions ) 4124 opts = pluginOptions; 4125 4126 $this.themeFlickrZoom( opts ); 4127 } ); 4128 } ); 4129 4130 } 4131 4132 // Lazy Load 4133 if ( $.fn.themePluginLazyLoad ) { 4134 4135 $( function() { 4136 $wrap.find( '[data-plugin-lazyload]:not(.manual)' ).each( function() { 4137 var $this = $( this ), 4138 opts; 4139 4140 var pluginOptions = $this.data( 'plugin-options' ); 4141 if ( pluginOptions ) 4142 opts = pluginOptions; 4143 $this.themePluginLazyLoad( opts ); 4144 } ); 4145 4146 if ( $wrap.find( '.porto-lazyload' ).length ) { 4147 $wrap.find( '.porto-lazyload' ).filter( function() { 4148 if ( $( this ).data( '__lazyload' ) || ( $( this ).closest( '.owl-carousel' ).length && $( this ).closest( '.owl-carousel' ).find( '.owl-item.cloned' ).length ) ) { 4149 return false; 4150 } 4151 return true; 4152 } ).themePluginLazyLoad( { effect: 'fadeIn', effect_speed: 400 } ); 4153 if ( $wrap.find( '.porto-lazyload' ).closest( '.nivoSlider' ).length ) { 4154 theme.requestTimeout( function() { 4155 $wrap.find( '.nivoSlider' ).each( function() { 4156 if ( $( this ).find( '.porto-lazyload' ).length ) { 4157 $( this ).closest( '.nivoSlider' ).find( '.nivo-main-image' ).attr( 'src', $( this ).closest( '.nivoSlider' ).find( '.porto-lazyload' ).eq( 0 ).attr( 'src' ) ); 4158 } 4159 } ); 4160 }, 100 ); 4161 } 4162 if ( $wrap.find( '.porto-lazyload' ).closest( '.porto-carousel-wrapper' ).length ) { 4163 theme.requestTimeout( function() { 4164 $wrap.find( '.porto-carousel-wrapper' ).each( function() { 4165 if ( $( this ).find( '.porto-lazyload:not(.lazy-load-loaded)' ).length ) { 4166 $( this ).find( '.slick-list' ).css( 'height', 'auto' ); 4167 //$( this ).find( '.porto-lazyload:not(.lazy-load-loaded)' ).trigger( 'appear' ); 4168 } 4169 } ); 4170 }, 100 ); 4171 } 4172 } 4173 } ); 4174 4175 } 4176 4177 // Masonry 4178 if ( $.fn.themeMasonry ) { 4179 4180 $( function() { 4181 $wrap.find( '[data-plugin-masonry]:not(.manual)' ).each( function() { 4182 var $this = $( this ), 4183 opts; 4184 if ( $this.hasClass( 'elementor-row' ) ) { 4185 $this.children( '.elementor-column' ).addClass( 'porto-grid-item' ); 4186 } 4187 var pluginOptions = $this.data( 'plugin-options' ); 4188 if ( pluginOptions ) 4189 opts = pluginOptions; 4190 $this.themeMasonry( opts ); 4191 } ); 4192 $wrap.find( '.posts-masonry .posts-container:not(.manual)' ).each( function() { 4193 var pluginOptions = $( this ).data( 'plugin-options' ); 4194 if ( !pluginOptions ) { 4195 pluginOptions = {}; 4196 } 4197 pluginOptions.itemSelector = '.post'; 4198 $( this ).themeMasonry( pluginOptions ); 4199 } ); 4200 $wrap.find( '.page-portfolios .portfolio-row:not(.manual)' ).each( function() { 4201 if ( $( this ).closest( '.porto-grid-container' ).length >
4201 0 || typeof $( this ).attr( 'data-plugin-masonry' ) != 'undefined' ) { 4202 return; 4203 } 4204 var $parent = $( this ).parent(), layoutMode = 'masonry', options, columnWidth = '.portfolio:not(.w2)', timer = null; 4205 4206 if ( $parent.hasClass( 'portfolios-grid' ) ) { 4207 //layoutMode = 'fitRows'; 4208 } else if ( $parent.hasClass( 'portfolios-masonry' ) ) { 4209 if ( !$parent.children( '.bounce-loader' ).length ) { 4210 $parent.append( '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>' ); 4211 } 4212 } 4213 4214 options = { 4215 itemSelector: '.portfolio', 4216 layoutMode: layoutMode, 4217 callback: function() { 4218 timer && clearTimeout( timer ); 4219 timer = setTimeout( function() { 4220 if ( typeof theme.FilterZoom !== 'undefined' ) { 4221 theme.FilterZoom.initialize( $( '.page-portfolios' ) ); 4222 } 4223 $parent.addClass( 'portfolio-iso-active' ); 4224 }, 400 ); 4225 } 4226 }; 4227 if ( layoutMode == 'masonry' ) { 4228 if ( !$parent.find( '.portfolio:not(.w2)' ).length ) 4229 columnWidth = '.portfolio'; 4230 options = $.extend( true, {}, options, { 4231 masonry: { columnWidth: columnWidth } 4232 } ); 4233 } 4234 4235 $( this ).themeMasonry( options ); 4236 4237 } ); 4238 $wrap.find( '.page-members .member-row:not(.manual)' ).each( function() { 4239 $( this ).themeMasonry( { 4240 itemSelector: '.member', 4241 //layoutMode: 'fitRows', 4242 callback: function() { 4243 setTimeout( function() { 4244 if ( typeof theme.FilterZoom !== 'undefined' ) { 4245 theme.FilterZoom.initialize( $( '.page-members' ) ); 4246 } 4247 }, 400 ); 4248 } 4249 } ); 4250 } ); 4251 } ); 4252 4253 } 4254 4255 // Toggle 4256 if ( $.fn.themeToggle ) { 4257 4258 $( function() { 4259 $wrap.find( 'section.toggle:not(.manual)' ).each( function() { 4260 var $this = $( this ), 4261 opts; 4262 4263 var pluginOptions = $this.data( 'plugin-options' ); 4264 if ( pluginOptions ) 4265 opts = pluginOptions; 4266 4267 $this.themeToggle( opts ); 4268 } ); 4269 } ); 4270 4271 } 4272 4273 // Parallax 4274 if ( $.fn.themeParallax ) { 4275 4276 $( function() { 4277 $wrap.find( '[data-plugin-parallax]:not(.manual)' ).each( function() { 4278 var $this = $( this ), 4279 opts; 4280 var pluginOptions = $this.data( 'plugin-options' ), 4281 parallaxScale = $this.attr( 'data-parallax-scale' ); 4282 if ( pluginOptions ) 4283 opts = pluginOptions; 4284 4285 if ( typeof parallaxScale !== 'undefined' ) { 4286 opts['scale'] = true; 4287 if ( parallaxScale == 'invert' ) { 4288 opts['scaleInvert'] = true; 4289 } 4290 } 4291 $this.themeParallax( opts ); 4292 } ); 4293 } ); 4294 } 4295 4296 // Scroll InViewPort 4297 if ( $.fn.themePluginInViewportStyle ) { 4298 $( function() { 4299 $wrap.find( '[data-inviewport-style]:not(.manual)' ).each( function() { 4300 var $this = $( this ), 4301 opts = $this.data( 'plugin-options' ); 4302 4303 $this.themePluginInViewportStyle( opts ); 4304 } ); 4305 } ); 4306 } 4307 4308 // Sticky 4309 if ( $.fn.themeSticky ) { 4310 4311 $( function() { 4312 $wrap.find( '[data-plugin-sticky]:not(.manual), .porto-sticky:not(.manual), .porto-sticky-nav:not(.manual)' ).each( function() { 4313 var $this = $( this ), 4314 opts; 4315 4316 var pluginOptions = $this.data( 'plugin-options' ); 4317 if ( pluginOptions ) 4318 opts = pluginOptions; 4319 if ( $this.is( ':visible' ) ) { 4320 $this.themeSticky( opts ); 4321 } 4322 } ); 4323 } ); 4324 } 4325 4326 // Float Element 4327 if ( $.fn['themePluginFloatElement'] ) { 4328 4329 $( function() { 4330 $wrap.find( '[data-plugin-float-element]:not(.manual)' ).each( function() { 4331 var $this = $( this ), 4332 opts; 4333 4334 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 4335 if ( pluginOptions ) 4336 opts = pluginOptions; 4337 4338 $this.themePluginFloatElement( opts ); 4339 } ); 4340 } ); 4341 } 4342 4343 /* Common */ 4344 4345 if ( typeof bootstrap != 'undefined' && typeof wrapObj != 'undefined' ) { 4346 // Tooltip 4347 var tooltipTriggerList = [].slice.call( wrapObj.querySelectorAll( "[data-bs-tooltip]:not(.manual), [data-toggle='tooltip']:not(.manual), .star-rating:not(.manual)" ) ); 4348 tooltipTriggerList.map( function( tooltipTriggerEl ) { 4349 return new bootstrap.Tooltip( tooltipTriggerEl ) 4350 } ); 4351 } 4352 // Tabs 4353 $wrap.find( 'a[data-bs-toggle="tab"]' ).off( 'shown.bs.tab' ).on( 'shown.bs.tab', function( e ) { 4354 $( this ).parents( '.nav-tabs' ).find( '.active' ).removeClass( 'active' ); 4355 $( this ).addClass( 'active' ).parent().addClass( 'active' ); 4356 4357 if ( $( this ).closest( '.tabs' ) ) { 4358 var _tabCarousel = $( this ).closest( '.tabs' ).find( '.tab-content>.active' ).find( '.owl-carousel' ); 4359 if ( ! _tabCarousel.data( 'owl.carousel' ) ) { 4360 _tabCarousel.themeCarousel( _tabCarousel.data( 'plugin-options') ); 4361 } 4362 } 4363 4364 } ); 4365 4366 if ( $.fn.vcwaypoint ) { 4367 // Progress bar tooltip 4368 $wrap.find( '.vc_progress_bar' ).each( function() { 4369 var $this = $( this ); 4370 if ( !$this.find( '.progress-bar-tooltip' ).length ) { 4371 return; 4372 } 4373 $this.vcwaypoint( function() { 4374 var $tooltips = $this.find( '.progress-bar-tooltip' ), 4375 index = 0, 4376 count = $tooltips.length; 4377 function loop() { 4378 theme.requestTimeout( function() { 4379 $tooltips.animate( { 4380 opacity: 1 4381 } ); 4382 }, 200 ); 4383 index++; 4384 if ( index < count ) { 4385 loop();
4386 } 4387 } 4388 loop(); 4389 }, { 4390 offset: '85%' 4391 } ); 4392 } ); 4393 } 4394 4395 // call async functions 4396 if ( typeof theme.initAsync == 'function' ) { 4397 theme.initAsync( $wrap, wrapObj ); 4398 } else { 4399 $( document.body ).on( 'porto_async_init', function() { 4400 theme.initAsync( $wrap, wrapObj ); 4401 } ); 4402 } 4403 4404 } )( jQuery ); 4405 4406 4407 jQuery( document.body ).trigger( 'porto_init', [$wrap] ); 4408} 4409 4410( function( theme, $ ) { 4411 4412 'use strict'; 4413 4414 $( document ).ready( function() { 4415 // update adminbar height 4416 var win_width = 0; 4417 $( window ).smartresize( function() { 4418 if ( win_width != window.innerWidth ) { 4419 theme.adminBarHeightNum = null; 4420 win_width = window.innerWidth; 4421 } 4422 } ); 4423 4424 // Scroll to Top 4425 if ( typeof theme.ScrollToTop !== 'undefined' ) { 4426 theme.ScrollToTop.initialize(); 4427 } 4428 setTimeout( function() { 4429 // Init Porto Theme 4430 porto_init(); 4431 }, 0 ); 4432 4433 ( function() { 4434 theme.bodyWidth = theme.bodyWidth || document.body.offsetWidth; 4435 // Mega Menu 4436 if ( typeof theme.MegaMenu !== 'undefined' ) { 4437 theme.MegaMenu.initialize(); 4438 } 4439 // Sidebar Menu 4440 if ( typeof theme.SidebarMenu !== 'undefined' ) { 4441 theme.SidebarMenu.initialize(); 4442 4443 $( '.sidebar-menu.side-menu-accordion' ).themeAccordionMenu( { 'open_one': true } ); 4444 } 4445 } )(); 4446 ( function() { 4447 // Overlay Menu 4448 if ( $( '.porto-popup-menu' ).length ) { 4449 $( '.porto-popup-menu .hamburguer-btn' ).on( 'click', function( e ) { 4450 e.preventDefault(); 4451 var $this = $( this ), $html = $( 'html' ); 4452 if ( $( '.porto-popup-menu-spacer' ).length ) { 4453 $( '.porto-popup-menu-spacer' ).remove(); 4454 } else { 4455 $( '<div class="porto-popup-menu-spacer"></div>' ).insertBefore( $this.parent() ); 4456 $( '.porto-popup-menu-spacer' ).width( $this.parent().width() ); 4457 } 4458 if ( $this.parent().hasClass( 'opened' ) ) { 4459 $html.css( 'overflow', '' ); 4460 $html.css( 'margin-right', '' ); 4461 } else { 4462 $html.css( 'margin-right', theme.getScrollbarWidth() ); 4463 $html.css( 'overflow', 'hidden' ); 4464 } 4465 $this.parent().toggleClass( 'opened' ); 4466 theme.requestFrame( function() { 4467 $this.toggleClass( 'active' ); 4468 } ); 4469 } ); 4470 $( '.porto-popup-menu .main-menu' ).scrollbar(); 4471 $( '.porto-popup-menu' ).on( 'click', 'li.menu-item-has-children > a', function( e ) { 4472 e.preventDefault(); 4473 $( this ).parent().siblings( 'li.menu-item-has-children.opened' ).removeClass( 'opened' ); 4474 $( this ).parent().toggleClass( 'opened' ); 4475 } ); 4476 } 4477 4478 // Side Navigation 4479 if ( typeof theme.SideNav !== 'undefined' ) { 4480 theme.SideNav.initialize(); 4481 } 4482 } )(); 4483 4484 setTimeout( () => { 4485 // Sticky Header 4486 if ( typeof theme.StickyHeader !== 'undefined' ) { 4487 theme.StickyHeader.initialize(); 4488 } 4489 // Hash Scroll 4490 if ( typeof theme.HashScroll !== 'undefined' ) { 4491 theme.HashScroll.initialize(); 4492 } 4493 } ); 4494 4495 4496 // Common 4497 4498 // skeleton screens 4499 if ( js_porto_vars.use_skeleton_screen.length > 0 && $( '.skeleton-loading' ).length ) { 4500 var dclFired = false, 4501 dclPromise = ( function() { 4502 var deferred = $.Deferred(); 4503 $( function() { 4504 deferred.resolve(); 4505 dclFired = true; 4506 } ); 4507 return deferred.promise(); 4508 } )(), 4509 observer = false, 4510 NativeMutationObserver = window.MutationObserver || window.WebkitMutationObserver || window.MozMutationObserver; 4511 if ( typeof NativeMutationObserver != 'undefined' ) { 4512 observer = new NativeMutationObserver( function( mutationsList, observer ) { 4513 for ( var i in mutationsList ) { 4514 var mutation = mutationsList[i]; 4515 if ( mutation.type == 'childList' ) { 4516 $( mutation.target ).trigger( 'skeleton:initialised' ); 4517 } 4518 } 4519 } ); 4520 } 4521 var killObserverTrigger = setTimeout( function() { 4522 if ( observer ) { 4523 observer.disconnect(); 4524 observer = undefined; 4525 } 4526 }, 4000 ); 4527 var skeletonTimer; 4528 $( '.skeleton-loading' ).each( function( e ) { 4529 var $this = $( this ), 4530 skeletonInitialisedPromise = ( function() { 4531 var deferred = $.Deferred(); 4532 $this.on( 'skeleton:initialised', function( evt ) { 4533 if ( evt.target.classList.contains( 'skeleton-loading' ) ) { 4534 deferred.resolve( evt ); 4535 } 4536 } ); 4537 return deferred.promise(); 4538 } )(),
4539 resourcesLoadedPromise = ( function() { 4540 return $.Deferred().resolve().promise(); 4541 } )(); 4542 $.when( skeletonInitialisedPromise, resourcesLoadedPromise, dclPromise ).done( function( e ) { 4543 var $real = $( e.target ), 4544 $placeholder = $real.siblings( '.skeleton-body' ); 4545 if ( !$placeholder.length ) { 4546 $placeholder = $real.parent().parent().parent().find( '[class="' + $real.attr( 'class' ).replace( 'skeleton-loading', 'skeleton-body' ) + '"]' ); 4547 } 4548 porto_init( $real ); 4549 if ( $real.find( '.sidebar-menu:not(.side-menu-accordion)' ).length ) { 4550 theme.SidebarMenu.initialize( $real.find( '.sidebar-menu:not(.side-menu-accordion)' ) ); 4551 } 4552 if ( skeletonTimer ) { 4553 theme.deleteTimeout( skeletonTimer ); 4554 } 4555 $real.trigger( 'skeleton-loaded' ); 4556 theme.requestTimeout( function() { 4557 if ( $placeholder.length ) { 4558 // fix YITH Products Filters compatibility issue 4559 if ( $placeholder.parent().hasClass( 'yit-wcan-container' ) ) { 4560 $placeholder.parent().remove(); 4561 } else { 4562 $placeholder.remove(); 4563 } 4564 } 4565 $real.removeClass( 'skeleton-loading' ); 4566 if ( $real.closest( '.skeleton-loading-wrap' ) ) { 4567 $real.closest( '.skeleton-loading-wrap' ).removeClass( 'skeleton-loading-wrap' ); 4568 } 4569 if ( $( document.body ).hasClass( 'elementor-default' ) || $( document.body ).hasClass( 'elementor-page' ) ) { 4570 $( window ).trigger( 'resize' ); 4571 } 4572 theme.refreshStickySidebar( false ); 4573 }, 100 ); 4574 if ( !$( '.skeleton-loading' ).length ) { 4575 clearTimeout( killObserverTrigger ); 4576 observer.disconnect(); 4577 observer = undefined; 4578 } 4579 } ); 4580 if ( $this.children( 'script[type="text/template"]' ).length ) { 4581 var content = $( JSON.parse( $this.children( 'script[type="text/template"]' ).eq( 0 ).html() ) ); 4582 $this.children( 'script[type="text/template"]' ).eq( 0 ).remove(); 4583 if ( observer ) { 4584 observer.observe( this, { childList: true, subtree: false } ); 4585 } 4586 $this.append( content ); 4587 if ( !observer ) { 4588 $this.trigger( 'skeleton:initialised' ); 4589 } 4590 } 4591 } ); 4592 } 4593 4594 $( document ).trigger( 'porto_theme_init' ); 4595 4596 } ); 4597 $( window ).on( 'load', function() { 4598 // Mobile Sidebar 4599 // filter popup events 4600 $( document ).on( 'click', '.sidebar-toggle', function( e ) { 4601 e.preventDefault(); 4602 var $html = $( 'html' ), 4603 $main = $( '#main' ), 4604 $this = $( this ); 4605 if ( $this.siblings( '.porto-product-filters' ).length ) { 4606 if ( $html.hasClass( 'filter-sidebar-opened' ) ) { 4607 $html.removeClass( 'filter-sidebar-opened' ); 4608 $this.siblings( '.sidebar-overlay' ).removeClass( 'active' ); 4609 if ( $html.hasClass( 'sidebar-right-opened' ) ) { 4610 $html.removeClass( 'sidebar-right-opened' ); 4611 } 4612 } else { 4613 $html.removeClass( 'sidebar-opened' ); 4614 $html.addClass( 'filter-sidebar-opened' ); 4615 $this.siblings( '.sidebar-overlay' ).addClass( 'active' ); 4616 if ( $main.hasClass( 'column2-right-sidebar' ) || $main.hasClass( 'column2-wide-right-sidebar' ) ) { 4617 $html.addClass( 'sidebar-right-opened' ); 4618 } 4619 } 4620 } else { 4621 if ( $html.hasClass( 'sidebar-opened' ) ) { 4622 $html.removeClass( 'sidebar-opened' ); 4623 $( '.sidebar-overlay' ).removeClass( 'active' ); 4624 if ( $html.hasClass( 'sidebar-right-opened' ) ) { 4625 $html.removeClass( 'sidebar-right-opened' ); 4626 } 4627 } else { 4628 $html.addClass( 'sidebar-opened' ); 4629 $( '.sidebar-overlay' ).addClass( 'active' ); 4630 //$( '.mobile-sidebar' ).find( '.porto-lazyload:not(.lazy-load-loaded)' ).trigger( 'appear' ); 4631 if ( $main.hasClass( 'column2-right-sidebar' ) || $main.hasClass( 'column2-wide-right-sidebar' ) ) { 4632 $html.addClass( 'sidebar-right-opened' ); 4633 } 4634 } 4635 } 4636 } ); 4637 4638 $( '#header .mini-cart' ).on( 'click', function( e ) { 4639 let $body = $( 'body' ); 4640 if ( js_porto_vars.cart_url && ( $body.hasClass( 'woocommerce-cart' ) || $body.hasClass( 'woocommerce-checkout' ) ) ) { 4641 location.href = js_porto_vars.cart_url; 4642 } 4643 }); 4644 $( '.minicart-offcanvas .cart-head' ).on( 'click', function() { 4645 let $body = $( 'body' ); 4646 if ( js_porto_vars.cart_url && ( $body.hasClass( 'woocommerce-cart' ) || $body.hasClass( 'woocommerce-checkout' ) ) ) { 4647 return; 4648 } 4649 var $this = $( this ); 4650 $this.closest( '.minicart-offcanvas' ).toggleClass( 'minicart-opened' ); 4651 if ( $this.closest( '.minicart-offcanvas' ).hasClass( 'minicart-opened' ) ) { 4652 $( 'html' ).css( 'margin-right', theme.getScrollbarWidth() ); 4653 $( 'html' ).css( 'overflow', 'hidden' ); 4654 } else { 4655 $( 'html' ).css( 'overflow', '' ); 4656 $( 'html' ).css( 'margin-right', '' ); 4657 } 4658 } ); 4659 4660 $( '.minicart-offcanvas .minicart-overlay' ).on( 'click', function() { 4661 $( this ).closest( '.minicart-offcanvas' ).removeClass( 'minicart-opened' ); 4662 $( 'html' ).css( 'overflow', '' ); 4663 $( 'html' ).css( 'margin-right', '' ); 4664 } ); 4665 4666 $( document.body ).on( 'click', '.sidebar-overlay', function() { 4667 var $html = $( 'html' ); 4668 $html.removeClass( 'sidebar-opened' ); 4669 $html.removeClass( 'filter-sidebar-opened' ); 4670 $( this ).removeClass( 'active' ); 4671 $html.removeClass( 'sidebar-right-opened' ); 4672 } ); 4673 4674 // Section Tab 4675 $( document.body ).on( 'click', '.section-tabs .nav-link', function( e ) { 4676 e.preventDefault(); 4677 var $this = $( this ), 4678 nav_id = $this.data( 'tab' ), 4679 $section_tab = $this.closest( '.section-tabs' ), 4680 $nav_wrap = $section_tab.children( 'ul.nav' ), 4681 $tab_content = $section_tab.children( '.tab-content' );
4682 if ( nav_id ) { 4683 // Nav Item 4684 $nav_wrap.find( '.active' ).removeClass( 'active' ); 4685 $this.addClass( 'active' ).parent( '.nav-item' ).addClass( 'active' ); 4686 4687 // Content Item 4688 $tab_content.find( '>.active' ).removeClass( 'show active' ); 4689 $tab_content.find( '>.tab-pane[id="' + nav_id + '"]' ).addClass( 'active' ); 4690 let _offsetHeight = $tab_content.find( '>.active' ).get(0).offsetHeight; 4691 $tab_content.find( '>.active' ).addClass( 'show' ); 4692 4693 var _tabCarousel = $tab_content.find( '>.active' ).find( '.owl-carousel' ); 4694 if ( ! _tabCarousel.data( 'owl.carousel' ) ) { 4695 _tabCarousel.themeCarousel( _tabCarousel.data( 'plugin-options') ); 4696 } 4697 } 4698 } ); 4699 4700 $( window ).on( 'resize', function( e ) { 4701 if ( e.originalEvent && window.innerWidth > 991 && $( 'html' ).hasClass( 'sidebar-opened' ) ) { 4702 $( '.sidebar-overlay' ).trigger( 'click' ); 4703 } 4704 } ); 4705 4706 // Match Height 4707 var $matchHeightObj = $( '.tabs-simple .featured-box .box-content, .porto-content-box .featured-box .box-content, .vc_general.vc_cta3, .match-height' ); 4708 if ( $matchHeightObj.length ) { 4709 if ( $.fn.matchHeight ) { 4710 $matchHeightObj.matchHeight(); 4711 } else { 4712 var script = document.createElement( "script" ); 4713 script.addEventListener( "load", function( event ) { 4714 $matchHeightObj.matchHeight(); 4715 } ); 4716 script.src = js_porto_vars.ajax_loader_url.replace( '/images/[email protected]', '/js/libs/jquery.matchHeight.min.js' ); 4717 script.async = true; 4718 document.body.appendChild( script ); 4719 } 4720 } 4721 4722 // WhatsApp Sharing 4723 if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ) ) { 4724 $( '.share-whatsapp' ).css( 'display', 'inline-block' ); 4725 } 4726 $( document ).ajaxComplete( function( event, xhr, options ) { 4727 if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ) ) { 4728 $( '.share-whatsapp' ).css( 'display', 'inline-block' ); 4729 } 4730 } ); 4731 4732 // Add Ege Browser Class 4733 var ua = window.navigator.userAgent, 4734 ie12 = ua.indexOf( 'Edge/' ) > 0; 4735 if ( ie12 ) $( 'html' ).addClass( 'ie12' ); 4736 4737 // Portfolio Link Lightbox 4738 $( document ).on( 'click', '.portfolios-lightbox a.portfolio-link', function( e ) { 4739 $( this ).find( '.thumb-info-zoom' ).trigger( 'click' ); 4740 return false; 4741 } ); 4742 4743 $( '.porto-faqs' ).each( function() { 4744 if ( $( this ).find( '.faq .toggle.active' ).length < 1 ) { 4745 $( this ).find( '.faq' ).eq( 0 ).find( '.toggle' ).addClass( 'active' ); 4746 $( this ).find( '.faq' ).eq( 0 ).find( '.toggle-content' ).show(); 4747 } 4748 } ); 4749 4750 // refresh wpb content 4751 $( document ).on( 'shown.bs.collapse', '.collapse', function() { 4752 var panel = $( this ); 4753 theme.refreshVCContent( panel ); 4754 } ); 4755 $( document ).on( 'shown.bs.tab', 'a[data-bs-toggle="tab"]', function( e ) { 4756 var panel = $( $( e.target ).attr( 'href' ) ); 4757 theme.refreshVCContent( panel ); 4758 } ); 4759 4760 // porto tooltip for header, footer 4761 $( '.porto-tooltip .tooltip-icon' ).on( 'click', function() { 4762 if ( $( this ).parent().children( ".tooltip-popup" ).css( "display" ) == "none" ) { 4763 $( this ).parent().children( ".tooltip-popup" ).fadeIn( 200 ); 4764 } else { 4765 $( this ).parent().children( ".tooltip-popup" ).fadeOut( 200 ); 4766 } 4767 } ); 4768 $( '.porto-tooltip .tooltip-close' ).on( 'click', function() { 4769 $( this ).parent().fadeOut( 200 ); 4770 } ); 4771 4772 // Add Scrollbar width 4773 $( 'body' ).css( '--porto-scroll-w', theme.getScrollbarWidth() + 'px' ); 4774 } ); 4775 4776} ).apply( this, [window.theme, jQuery] ); 4777 4778( function( theme, $, undefined ) { 4779 "use strict"; 4780 4781 $( document ).ready( function() { 4782 $( window ).on( 'vc_reload', function() { 4783 porto_init(); 4784 $( '.type-post' ).addClass( 'post' ); 4785 $( '.type-portfolio' ).addClass( 'portfolio' ); 4786 $( '.type-member' ).addClass( 'member' ); 4787 $( '.type-block' ).addClass( 'block' ); 4788 } ); 4789 } ); 4790 4791 /* 4792 * Experience Timeline 4793 */ 4794 var timelineHeightAdjust = { 4795 $timeline: $( '#exp-timeline' ), 4796 $timelineBar: $( '#exp-timeline .timeline-bar' ), 4797 $firstTimelineItem: $( '#exp-timeline .timeline-box' ).first(), 4798 $lastTimelineItem: $( '#exp-timeline .timeline-box' ).last(), 4799 4800 build: function() { 4801 var self = this; 4802 4803 self.adjustHeight(); 4804 }, 4805 adjustHeight: function() { 4806 var self = this, 4807 calcFirstItemHeight = ( self.$firstTimelineItem.outerHeight( true ) / 2 ) + 5, 4808 calcLastItemHeight = ( self.$lastTimelineItem.outerHeight( true ) / 2 ) + 5; 4809 4810 // Set Timeline Bar Top and Bottom 4811 self.$timelineBar.css( { 4812 top: calcFirstItemHeight, 4813 bottom: calcLastItemHeight 4814 } ); 4815 } 4816 } 4817 4818 if ( $( '#exp-timeline' ).get( 0 ) ) { 4819 // Adjust Timeline Height On Resize 4820 var timeline_timer = null; 4821 $( window ).smartresize( function() { 4822 if ( timeline_timer ) { 4823 clearTimeout( timeline_timer ); 4824 } 4825 timeline_timer = setTimeout( function() { 4826 timelineHeightAdjust.build(); 4827 }, 800 ); 4828 } ); 4829 4830 timelineHeightAdjust.build(); 4831 } 4832 4833 $( '.custom-view-our-location' ).on( 'click', function( e ) { 4834 e.preventDefault(); 4835 var this_ = $( this ); 4836 $( '.custom-googlemap' ).slideDown( '1000', function() { 4837 this_.delay( 700 ).hide(); 4838 } ); 4839 } ); 4840 4841} )( window.theme, jQuery ); 4842 4843// Porto 4.0 extra shortcodes 4844( function( theme, $, undefined ) { 4845 'use strict'; 4846 4847 window.addEventListener( 'load', function() { 4848 theme.isLoaded = true; 4849 } ); 4850 4851 $( document ).ready( function() { 4852 if ( typeof elementorFrontend != 'undefined' ) { 4853 // fix Elementor ScrollTop 4854 $( window ).on( 'elementor/frontend/init', function() { 4855 elementorFrontend.hooks.addFilter( 'frontend/handlers/menu_anchor/scroll_top_distance', function( scrollTop ) { 4856 if ( theme && theme.StickyHeader && typeof theme.sticky_nav_height != 'undefined' ) { 4857 if ( elementorFrontend.elements.$wpAdminBar.length ) { 4858 scrollTop += elementorFrontend.elements.$wpAdminBar.height(); 4859 } 4860 scrollTop = scrollTop - theme.adminBarHeight() - theme.StickyHeader.sticky_height - theme.sticky_nav_height + 1; 4861 } 4862 return scrollTop; 4863 } ); 4864 } ); 4865 } 4866 } ); 4867 4868 // widget wysija 4869 $( '#footer .widget_wysija .wysija-submit:not(.btn)' ).addClass( 'btn btn-default' ); 4870 4871 // fixed visual compoer issue which has owl carousel 4872 if ( $( '[data-vc-parallax] .owl-carousel' ).length ) { 4873 theme.requestTimeout( function() { if ( typeof window.vcParallaxSkroll == 'object' ) { window.vcParallaxSkroll.refresh(); } }, 200 ); 4874 } 4875 4876 if ( $( '.page-content > .alignfull, .post-content > .alignfull' ).length ) { 4877 var initAlignFull = function() { 4878 $( '.page-content > .alignfull, .post-content > .alignfull' ).each( function() { 4879 $( this ).css( 'left', -1 * $( this ).parent().offset().left ).css( 'right', -1 * $( this ).parent().offset().left ).css( 'width', $( 'body' ).width() - ( parseInt( $( this ).css( 'margin-left' ), 10 ) + parseInt( $( this ).css( 'margin-right' ), 10 ) ) ); 4880 } ); 4881 };
4882 initAlignFull(); 4883 $( window ).smartresize( function() { 4884 initAlignFull(); 4885 } ); 4886 } 4887} )( window.theme, jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.