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 || (window.theme = {}); 158// Configuration 159( function( theme, $ ) { 160 'use strict'; 161 162 theme = theme || {}; 163 164 $.extend( theme, { 165 166 rtl: js_porto_vars.rtl == '1' ? true : false, 167 rtl_browser: $( 'html' ).hasClass( 'browser-rtl' ), 168 169 ajax_url: js_porto_vars.ajax_url, 170 request_error: js_porto_vars.request_error, 171 172 change_logo: js_porto_vars.change_logo == '1' ? true : false, 173 174 show_sticky_header: js_porto_vars.show_sticky_header == '1' ? true : false, 175 show_sticky_header_tablet: js_porto_vars.show_sticky_header_tablet == '1' ? true : false, 176 show_sticky_header_mobile: js_porto_vars.show_sticky_header_mobile == '1' ? true : false, 177 178 category_ajax: js_porto_vars.category_ajax == '1' ? true : false, 179 prdctfltr_ajax: js_porto_vars.prdctfltr_ajax == '1' ? true : false, 180 181 container_width: parseInt( js_porto_vars.container_width ), 182 grid_gutter_width: parseInt( js_porto_vars.grid_gutter_width ), 183 screen_xl: parseInt( js_porto_vars.screen_xl ), 184 screen_xxl: parseInt( js_porto_vars.screen_xxl ), 185 slider_loop: js_porto_vars.slider_loop == '1' ? true : false, 186 slider_autoplay: js_porto_vars.slider_autoplay == '1' ? true : false, 187 slider_autoheight: js_porto_vars.slider_autoheight == '1' ? true : false, 188 slider_speed: js_porto_vars.slider_speed ? js_porto_vars.slider_speed : 5000, 189 slider_nav: js_porto_vars.slider_nav == '1' ? true : false, 190 slider_nav_hover: js_porto_vars.slider_nav_hover == '1' ? true : false, 191 slider_margin: js_porto_vars.slider_margin == '1' ? 40 : 0, 192 slider_dots: js_porto_vars.slider_dots == '1' ? true : false, 193 slider_animatein: js_porto_vars.slider_animatein ? js_porto_vars.slider_animatein : '', 194 slider_animateout: js_porto_vars.slider_animateout ? js_porto_vars.slider_animateout : '', 195 product_thumbs_count: js_porto_vars.product_thumbs_count ? parseInt( js_porto_vars.product_thumbs_count, 10 ) : 4, 196 product_zoom: js_porto_vars.product_zoom == '1' ? true : false, 197 product_zoom_mobile: js_porto_vars.product_zoom_mobile == '1' ? true : false, 198 product_image_popup: js_porto_vars.product_image_popup == '1' ? 'fadeOut' : false, 199 innerHeight: window.innerHeight, 200 animation_support: !$( 'html' ).hasClass( 'no-csstransitions' ), 201 202 owlConfig: { 203 rtl: js_porto_vars.rtl == '1' ? true : false, 204 loop: js_porto_vars.slider_loop == '1' ? true : false, 205 autoplay: js_porto_vars.slider_autoplay == '1' ? true : false, 206 autoHeight: js_porto_vars.slider_autoheight == '1' ? true : false, 207 autoplayTimeout: js_porto_vars.slider_speed ? js_porto_vars.slider_speed : 7000, 208 autoplayHoverPause: true, 209 lazyLoad: true, 210 nav: js_porto_vars.slider_nav == '1' ? true : false, 211 navText: ["", ""], 212 dots: js_porto_vars.slider_dots == '1' ? true : false, 213 stagePadding: ( js_porto_vars.slider_nav_hover != '1' && js_porto_vars.slider_margin == '1' ) ? 40 : 0, 214 animateOut: js_porto_vars.slider_animateout ? js_porto_vars.slider_animateout : '', 215 animateIn: js_porto_vars.slider_animatein ? js_porto_vars.slider_animatein : '' 216 }, 217 218 sticky_nav_height: 0, 219 220 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 )|
220sy(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 ) ), 221 222 getScrollbarWidth: function() { 223 224 if ( this.scrollbarSize === undefined ) { 225 this.scrollbarSize = window.innerWidth - document.documentElement.clientWidth; 226 } 227 return this.scrollbarSize; 228 }, 229 230 isTablet: function() { 231 if ( window.innerWidth < 992 ) 232 return true; 233 return false; 234 }, 235 236 isMobile: function() { 237 if ( window.innerWidth <= 480 ) 238 return true; 239 return false; 240 }, 241 242 isIOS: function () { 243 return [ 244 'iPad Simulator', 245 'iPhone Simulator', 246 'iPod Simulator', 247 'iPad', 248 'iPhone', 249 'iPod' 250 ].includes(navigator.platform) 251 // iPad on iOS 13 detection 252 || (navigator.userAgent.includes("Mac") && "ontouchend" in document); 253 }, 254 255 refreshVCContent: function( $elements ) { 256 if ( $elements || $( document.body ).hasClass( 'elementor-page' ) ) { 257 $( window ).trigger( 'resize' ); 258 } 259 theme.refreshStickySidebar( true ); 260 261 if ( typeof window.vc_js == 'function' ) 262 window.vc_js(); 263 264 $( document.body ).trigger( 'porto_refresh_vc_content', [$elements] ); 265 }, 266 267 adminBarHeight: function() { 268 if ( theme.adminBarHeightNum || 0 === theme.adminBarHeightNum ) { 269 return theme.adminBarHeightNum; 270 } 271 var obj = document.getElementById( 'wpadminbar' ), 272 fixed_top = $( '.porto-scroll-progress.fixed-top:not(.fixed-under-header)' ); 273 if ( fixed_top.length && '0px' == fixed_top.css( 'margin-top' ) ) { 274 theme.adminBarHeightNum = fixed_top.height(); 275 } else { 276 theme.adminBarHeightNum = 0; 277 } 278 if ( obj && obj.offsetHeight && window.innerWidth > 600 ) { 279 theme.adminBarHeightNum += obj.offsetHeight; 280 } 281 282 return theme.adminBarHeightNum; 283 }, 284 285 refreshStickySidebar: function( timeout, $sticky_sidebar ) { 286 if ( typeof $sticky_sidebar == 'undefined' ) { 287 $sticky_sidebar = $( '.sidebar [data-plugin-sticky]' ); 288 } 289 if ( $sticky_sidebar.get( 0 ) ) { 290 if ( timeout ) { 291 theme.requestTimeout( function() { 292 $sticky_sidebar.trigger( 'recalc.pin' ); 293 }, 400 ); 294 } else { 295 $sticky_sidebar.trigger( 'recalc.pin' ); 296 } 297 } 298 }, 299 300 scrolltoContainer: function( $container, timeout ) { 301 if ( $container.get( 0 ) ) { 302 if ( window.innerWidth < 992 ) { 303 $( '.sidebar-overlay' ).trigger( 'click' ); 304 } 305 if ( !timeout ) { 306 timeout = 600; 307 } 308 $( 'html, body' ).stop().animate( { 309 scrollTop: $container.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height - 18 310 }, timeout, 'easeOutQuad' ); 311 } 312 }, 313 314 requestFrame: function( fn ) { 315 var handler = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; 316 if ( !handler ) { 317 return setTimeout( fn, 1000 / 60 ); 318 } 319 var rt = new Object() 320 rt.val = handler( fn ); 321 return rt; 322 }, 323 324 requestTimeout: function( fn, delay ) { 325 var handler = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; 326 if ( !handler ) { 327 return setTimeout( fn, delay ); 328 } 329 var start, rt = new Object(); 330 331 function loop( timestamp ) { 332 if ( !start ) { 333 start = timestamp; 334 } 335 var progress = timestamp - start; 336 progress >= delay ? fn.call() : rt.val = handler( loop ); 337 }; 338 339 rt.val = handler( loop ); 340 return rt; 341 }, 342 343 deleteTimeout: function( timeoutID ) { 344 if ( !timeoutID ) { 345 return; 346 } 347 var handler = window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame; 348 if ( !handler ) { 349 return clearTimeout( timeoutID ); 350 } 351 if ( timeoutID.val ) { 352 return handler( timeoutID.val ); 353 } 354 }, 355 356 execPluginFunction: function( functionName, context ) { 357 var args = Array.prototype.slice.call( arguments, 2 ); 358 var namespaces = functionName.split( "." ); 359 var func = namespaces.pop(); 360 361 for ( var i = 0; i < namespaces.length; i++ ) { 362 context = context[namespaces[i]]; 363 } 364 365 return context[func].apply( context, args ); 366 }, 367 368 getOptions: function( opts ) { 369 if ( typeof ( opts ) == 'object' ) { 370 return opts; 371 } else if ( typeof ( opts ) == 'string' ) { 372 try { 373 return JSON.parse( opts.replace( /'/g, '"' ).replace( ';', '' ) ); 374 } catch ( e ) { 375 return {}; 376 } 377 } else { 378 return {}; 379 } 380 }, 381 mergeOptions: function( obj1, obj2 ) { 382 var obj3 = {}; 383 for ( var attrname in obj1 ) { obj3[attrname] = obj1[attrname]; } 384 for ( var attrname in obj2 ) { obj3[attrname] = obj2[attrname]; } 385 return obj3; 386 }, 387 388 intObs: function( selector, functionName, accY ) { 389 var $el; 390 if ( typeof selector == 'string' ) { 391 $el = document.querySelectorAll( selector ); 392 } else { 393 $el = selector; 394 } 395 var intersectionObserverOptions = { 396 rootMargin: '200px' 397 } 398 if ( typeof accY != 'undefined' ) { 399 intersectionObserverOptions.rootMargin = '0px 0px ' + Number( accY ) + 'px 0px'; 400 } 401 402 var observer = new IntersectionObserver( function( entries ) { 403 for ( var i = 0; i < entries.length; i++ ) { 404 var entry = entries[i];
405 if ( entry.intersectionRatio > 0 ) { 406 var $this = $( entry.target ), 407 opts; 408 409 if ( typeof functionName == 'string' ) { 410 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 411 if ( pluginOptions ) 412 opts = pluginOptions; 413 414 theme.execPluginFunction( functionName, $this, opts ); 415 } else { 416 var callback = functionName; 417 callback.call( $this ); 418 } 419 420 // Unobserve 421 observer.unobserve( entry.target ); 422 } 423 } 424 }, intersectionObserverOptions ); 425 426 Array.prototype.forEach.call( $el, function( obj ) { 427 observer.observe( obj ); 428 } ); 429 }, 430 431 dynIntObsInit: function( selector, functionName, pluginDefaults ) { 432 var $el; 433 if ( typeof selector == 'string' ) { 434 $el = document.querySelectorAll( selector ); 435 } else { 436 $el = selector; 437 } 438 439 Array.prototype.forEach.call( $el, function( obj ) { 440 var $this = $( obj ), 441 opts; 442 if ( $this.data( 'observer-init' ) ) { 443 return; 444 } 445 446 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 447 if ( pluginOptions ) 448 opts = pluginOptions; 449 450 var mergedPluginDefaults = theme.mergeOptions( pluginDefaults, opts ) 451 452 var intersectionObserverOptions = { 453 rootMargin: '0px 0px 200px 0px', 454 thresholds: 0 455 } 456 if ( mergedPluginDefaults.accY ) { 457 intersectionObserverOptions.rootMargin = '0px 0px ' + Number( mergedPluginDefaults.accY ) + 'px 0px'; 458 } 459 460 var observer = new IntersectionObserver( function( entries ) { 461 for ( var i = 0; i < entries.length; i++ ) { 462 var entry = entries[i]; 463 if ( entry.intersectionRatio > 0 ) { 464 theme.execPluginFunction( functionName, $this, mergedPluginDefaults ); 465 466 // Unobserve 467 observer.unobserve( entry.target ); 468 } 469 } 470 }, intersectionObserverOptions ); 471 472 observer.observe( obj ); 473 $this.data( 'observer-init', true ); 474 } ); 475 } 476 477 } ); 478 479 if ( theme.isIOS() ) { 480 document.body.classList.add( 'ios' ); 481 } 482 483 $.extend( theme, { 484 add_query_arg: function( key, value ) { 485 key = escape( key ); value = escape( value ); 486 487 var s = document.location.search; 488 var kvp = key + "=" + value; 489 490 var r = new RegExp( "(&|\\?)" + key + "=[^\&]*" ); 491 492 s = s.replace( r, "$1" + kvp ); 493 494 if ( !RegExp.$1 ) { s += ( s.length > 0 ? '&' : '?' ) + kvp; }; 495 496 //again, do what you will here 497 return s; 498 }, 499 addUrlParam: function (href, name, value) { 500 var url = document.createElement('a'), s, r; 501 href = decodeURIComponent(decodeURI(href)); 502 url.href = href; 503 s = url.search; 504 if (0 <= s.indexOf(name + '=')) { 505 r = s.replace(new RegExp(name + '=[^&]*'), name + '=' + value); 506 } else { 507 r = (s.length && 0 <= s.indexOf('?')) ? s : '?'; 508 r.endsWith('?') || (r += '&'); 509 r += name + '=' + value; 510 } 511 return encodeURI(href.replace(s, '') + r.replace(/&+/, '&')); 512 }, 513 removeUrlParam: function (href, name) { 514 var url = document.createElement('a'), s, r; 515 href = decodeURIComponent(decodeURI(href)); 516 url.href = href; 517 s = url.search; 518 if (0 <= s.indexOf(name + '=')) { 519 r = s.replace(new RegExp(name + '=[^&]*'), '').replace(/&+/, '&').replace('?&', '?'); 520 r.endsWith('&') && (r = r.substr(0, r.length - 1)); 521 r.endsWith('?') && (r = r.substr(0, r.length - 1)); 522 r = r.replace('&&', '&'); 523 } else { 524 r = s; 525 } 526 return encodeURI(href.replace(s, '') + r); 527 } 528 } ); 529 530} ).apply( this, [window.theme, jQuery] ); 531 532 533( function( theme, $ ) { 534 'use strict'; 535 theme = theme || {}; 536 537 var disableMobileAnimations = function () { 538 if ( $( document.body ).hasClass( 'porto-dm-animate' ) && window.innerWidth < 768 ) { 539 theme.animation_support = false; 540 $( '[data-appear-animation]' ).removeAttr( 'data-appear-animation' ); 541 $( '.elementor-invisible' ).removeAttr( 'data-settings' ).removeData( 'settings' ).removeClass( 'elementor-invisible' ) 542 .add( $( '.appear-animation' ).removeClass( 'appear-animation' ) ); 543 } 544 } 545 // expose to scope 546 $.extend( theme, { 547 disableMobileAnimations: disableMobileAnimations 548 } ); 549 theme.disableMobileAnimations(); 550} ).apply( this, [window.theme, jQuery] ); 551 552/** 553 * Copyright 2016 Google Inc. All Rights Reserved. 554 * 555 * Licensed under the W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE. 556 * 557 * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document 558 * 559 */ 560!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 560
560 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;
560 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 } }(); 561 562/* browser select */ 563( function( $ ) { 564 'use strict'; 565 $.extend( { 566 567 browserSelector: function() { 568 569 // Touch 570 var hasTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; 571 572 var u = navigator.userAgent, 573 ua = u.toLowerCase(), 574 is = function( t ) { 575 return ua.indexOf( t ) > -1; 576 }, 577 g = 'gecko', 578 w = 'webkit', 579 s = 'safari', 580 o = 'opera', 581 h = document.documentElement, 582 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']; 583 584 var c = b.join( ' ' ); 585 586 if ( theme.is_device_mobile ) { 587 c += ' mobile'; 588 } 589 590 if ( hasTouch ) { 591 c += ' touch'; 592 } 593 594 h.className += ' ' + c; 595 596 // IE11 Detect 597 var isIE11 = !( window.ActiveXObject ) && "ActiveXObject" in window; 598 599 if ( isIE11 ) { 600 $( 'html' ).removeClass( 'gecko' ).addClass( 'ie ie11' ); 601 return; 602 } 603 } 604 605 } ); 606 607 $.browserSelector(); 608 609} )( jQuery ); 610 611// Accordion 612( function( theme, $ ) { 613 'use strict'; 614 615 theme = theme || {}; 616 var instanceName = '__accordion'; 617 var Accordion = function( $el, opts ) { 618 return this.initialize( $el, opts ); 619 }; 620 Accordion.defaults = { 621 }; 622 Accordion.prototype = { 623 initialize: function( $el, opts ) { 624 if ( $el.data( instanceName ) ) { 625 return this; 626 } 627 628 this.$el = $el; 629 630 this 631 .setData() 632 .setOptions( opts ) 633 .build(); 634 635 return this; 636 }, 637 638 setData: function() { 639 this.$el.data( instanceName, this ); 640 return this; 641 }, 642 643 setOptions: function( opts ) { 644 this.options = $.extend( true, {}, Accordion.defaults, opts, { 645 wrapper: this.$el 646 } ); 647 648 return this; 649 }, 650 651 build: function() { 652 // if ( !$.fn.collapse ) { 653 // return this; 654 // } 655 656 var polyfillCollapse = function( selector ) { 657 $( selector ).each( function() { 658 let $this = $( this ); 659 $this.addClass( 'show' ); 660 $this.prev().find( '.accordion-toggle' ).removeClass( 'collapsed' ).attr( 'aria-expanded', true ); 661 }); 662 } 663 664 var $el = this.options.wrapper, 665 $collapse = $el.find( '.collapse' ), 666 collapsible = $el.data( 'collapsible' ), 667 active_num = $el.data( 'active-tab' ); 668 669 if ( $collapse.length > 0 ) { 670 if ( $el.data( 'use-accordion' ) && 'yes' == $el.data( 'use-accordion' ) ) { 671 $el.find( '.collapse' ).attr( 'data-bs-parent', '#' + $el.attr( 'id' ) ); 672 } 673 if ( collapsible == 'yes' ) { 674 if ( $.fn.collapse ) { 675 $collapse.collapse( { toggle: false, parent: '#' + $el.attr( 'id' ) } ); 676 } 677 } else if ( !isNaN( active_num ) && active_num == parseInt( active_num ) && $el.find( '.collapse' ).length >= active_num ) { 678 if ( !$.fn.collapse ) { 679 polyfillCollapse( $el.find( '.collapse' ).eq( active_num - 1 ) ); 680 } else { 681 $el.find( '.collapse' ).collapse( { toggle: false, parent: '#' + $el.attr( 'id' ) } ); 682 $el.find( '.collapse' ).eq( active_num - 1 ).collapse( 'toggle' ); 683 } 684 } else { 685 if ( !$.fn.collapse ) { 686 polyfillCollapse( $el.find( '.collapse' ) ); 687 } else { 688 $el.find( '.collapse' ).collapse( { parent: '#' + $el.attr( 'id' ) } ); 689 } 690 } 691 } 692 693 return this; 694 } 695 }; 696 697 // expose to scope 698 $.extend( theme, { 699 Accordion: Accordion 700 } ); 701 702 // jquery plugin 703 $.fn.themeAccordion = function( opts ) { 704 return this.map( function() { 705 var $this = $( this ); 706 707 if ( $this.data( instanceName ) ) { 708 return $this.data( instanceName ); 709 } else { 710 return new theme.Accordion( $this, opts ); 711 } 712 713 } ); 714 }; 715 716} ).apply( this, [window.theme, jQuery] ); 717 718 719// Accordion Menu 720( function( theme, $ ) { 721 722 'use strict'; 723 724 theme = theme || {}; 725 726 var instanceName = '__accordionMenu'; 727 728 var AccordionMenu = function( $el, opts ) { 729 return this.initialize( $el, opts ); 730 }; 731 732 AccordionMenu.defaults = { 733 734 }; 735 736 AccordionMenu.prototype = { 737 initialize: function( $el, opts ) { 738 if ( $el.data( instanceName ) ) { 739 return this; 740 } 741 742 this.$el = $el; 743 744 this 745 .setData() 746 .setOptions( opts ) 747 .build(); 748 749 return this; 750 }, 751 752 setData: function() { 753 this.$el.data( instanceName, this ); 754 755 return this; 756 }, 757 758 setOptions: function( opts ) { 759 this.options = $.extend( true, {}, AccordionMenu.defaults, opts, { 760 wrapper: this.$el 761 } ); 762 763 return this; 764 }, 765 766 build: function() { 767 var self = this, 768 $el = this.options.wrapper; 769 770 $el.find( 'li.menu-item.active' ).each( function() { 771 var $this = $( this ); 772 773 if ( $this.find( '> .arrow' ).get( 0 ) ) 774 $this.find( '> .arrow' ).trigger( 'click' ); 775 } ); 776 777 $el.on( 'click', '.arrow', function( e ) { 778 e.preventDefault(); 779 e.stopPropagation(); 780 var $this = $( this ), 781 $parent = $this.closest( 'li' ); 782 if ( typeof self.options.open_one != 'undefined' ) { 783 $parent.siblings( '.open' ).children( '.arrow' ).next().hide(); 784 $parent.siblings( '.open' ).removeClass( 'open' ); 785 $this.next().stop().toggle(); 786 } else { 787 $this.next().stop().slideToggle(); 788 } 789 if ( $parent.hasClass( 'open' ) ) { 790 $parent.removeClass( 'open' ); 791 } else { 792 $parent.addClass( 'open' ); 793 } 794 if ( $this.closest( '.header-side-nav .sidebar-menu' ).length ) { // for side header
795 $( '.header-side-nav [data-plugin-sticky]' ).trigger( 'recalc.pin' ); 796 } 797 return false; 798 } ); 799 800 $el.find( '.menu-item-has-children' ).each( function () { 801 var $this = $(this); 802 if ( $this.find( '>.sub-menu > li:not(.hidden-item)' ).length == 0 ) { 803 $this.addClass( 'hidden-item' ); 804 } 805 } ); 806 807 return this; 808 } 809 }; 810 811 // expose to scope 812 $.extend( theme, { 813 AccordionMenu: AccordionMenu 814 } ); 815 816 // jquery plugin 817 $.fn.themeAccordionMenu = function( opts ) { 818 return this.map( function() { 819 var $this = $( this ); 820 821 if ( $this.data( instanceName ) ) { 822 return $this.data( instanceName ); 823 } else { 824 return new theme.AccordionMenu( $this, opts ); 825 } 826 827 } ); 828 }; 829 830} ).apply( this, [window.theme, jQuery] ); 831 832 833// Flickr Zoom 834( function( theme, $ ) { 835 'use strict'; 836 837 theme = theme || {}; 838 839 var instanceName = '__flickrZoom'; 840 841 var FlickrZoom = function( $el, opts ) { 842 return this.initialize( $el, opts ); 843 }; 844 845 FlickrZoom.defaults = { 846 847 }; 848 849 FlickrZoom.prototype = { 850 initialize: function( $el, opts ) { 851 if ( $el.data( instanceName ) ) { 852 return this; 853 } 854 855 this.$el = $el; 856 857 this 858 .setData() 859 .setOptions( opts ) 860 .build(); 861 862 return this; 863 }, 864 865 setData: function() { 866 this.$el.data( instanceName, this ); 867 868 return this; 869 }, 870 871 setOptions: function( opts ) { 872 this.options = $.extend( true, {}, FlickrZoom.defaults, opts, { 873 wrapper: this.$el 874 } ); 875 876 return this; 877 }, 878 879 build: function() { 880 var $el = this.options.wrapper, 881 links = [], 882 i = 0, 883 $flickr_links = $el.find( '.flickr_badge_image > a' ); 884 885 $flickr_links.each( function() { 886 var slide = {}, 887 $image = $( this ).find( '> img' ); 888 889 slide.src = $image.attr( 'src' ).replace( '_s.', '_b.' ); 890 slide.title = $image.attr( 'title' ); 891 links[i] = slide; 892 i++; 893 } ); 894 895 $flickr_links.on( 'click', function( e ) { 896 e.preventDefault(); 897 if ( $.fn.magnificPopup ) { 898 $.magnificPopup.close(); 899 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 900 items: links, 901 gallery: { 902 enabled: true 903 }, 904 type: 'image' 905 } ), $flickr_links.index( $( this ) ) ); 906 } 907 } ); 908 909 return this; 910 } 911 }; 912 913 // expose to scope 914 $.extend( theme, { 915 FlickrZoom: FlickrZoom 916 } ); 917 918 // jquery plugin 919 $.fn.themeFlickrZoom = function( opts ) { 920 return this.map( function() { 921 var $this = $( this ); 922 923 if ( $this.data( instanceName ) ) { 924 return $this.data( instanceName ); 925 } else { 926 return new theme.FlickrZoom( $this, opts ); 927 } 928 929 } ); 930 } 931 932} ).apply( this, [window.theme, jQuery] ); 933 934// Lazy Load 935( function( theme, $ ) { 936 'use strict'; 937 938 theme = theme || {}; 939 940 var instanceName = '__lazyload'; 941 942 var PluginLazyLoad = function( $el, opts ) { 943 return this.initialize( $el, opts ); 944 }; 945 946 PluginLazyLoad.defaults = { 947 effect: 'show', 948 appearEffect: '', 949 appear: function( elements_left, settings ) { 950 951 }, 952 load: function( elements_left, settings ) { 953 $( this ).addClass( 'lazy-load-loaded' ); 954 } 955 }; 956 957 PluginLazyLoad.prototype = { 958 initialize: function( $el, opts ) { 959 if ( !$el.length ) { 960 return this; 961 } 962 963 if ( !$.fn.lazyload ) { 964 return this; 965 } 966 967 var options = $.extend( true, {}, PluginLazyLoad.defaults, opts, {} ); 968 return lazyload( $el, options ); 969 } 970 }; 971 972 // expose to scope 973 $.extend( theme, { 974 PluginLazyLoad: PluginLazyLoad 975 } ); 976 977 // jquery plugin 978 $.fn.themePluginLazyLoad = function( opts ) { 979 var $this = $( this ); 980 if ( $this.data( instanceName ) ) { 981 return this; 982 } else { 983 var ins = new PluginLazyLoad( $.makeArray( this ), opts ); 984 $this.data( instanceName, ins ); 985 } 986 return this; 987 } 988 989} ).apply( this, [window.theme, jQuery] ); 990 991// Masonry 992( function( theme, $ ) { 993 'use strict'; 994 995 theme = theme || {}; 996 997 var instanceName = '__masonry'; 998 999 var Masonry = function( $el, opts ) { 1000 return this.initialize( $el, opts ); 1001 }; 1002 1003 Masonry.defaults = { 1004 itemSelector: 'li', 1005 isOriginLeft: !theme.rtl 1006 }; 1007 1008 Masonry.prototype = { 1009 initialize: function( $el, opts ) { 1010 if ( $el.data( instanceName ) ) { 1011 return this; 1012 } 1013 1014 this.$el = $el; 1015 1016 this 1017 .setData() 1018 .setOptions( opts ) 1019 .build(); 1020 1021 return this; 1022 }, 1023 1024 setData: function() { 1025 this.$el.data( instanceName, this ); 1026 1027 return this; 1028 }, 1029 1030 setOptions: function( opts ) { 1031 this.options = $.extend( true, {}, Masonry.defaults, opts, { 1032 wrapper: this.$el 1033 } ); 1034 1035 return this; 1036 }, 1037 1038 build: function() { 1039 if ( !$.fn.isotope ) { 1040 return this; 1041 } 1042 1043 var self = this, 1044 $el = this.options.wrapper, 1045 trigger_timer = null; 1046 $el.isotope( this.options ); 1047 $el.isotope( 'on', 'layoutComplete', function() { 1048 if ( typeof this.options.callback == 'function' ) { 1049 this.options.callback.call(); 1050 } 1051 1052 if ( $el.find( '.porto-lazyload:not(.lazy-load-loaded):visible' ).length ) { 1053 $( window ).trigger( 'scroll' ); 1054 } 1055 } ); 1056 $el.isotope( 'layout' ); 1057 self.resize(); 1058 $( window ).smartresize( function() { 1059 self.resize() 1060 } ); 1061 1062 return this; 1063 }, 1064 1065 resize: function() { 1066 var self = this, 1067 $el = this.options.wrapper; 1068 1069 if ( self.resizeTimer ) { 1070 theme.deleteTimeout( self.resizeTimer ); 1071 } 1072 1073 self.resizeTimer = theme.requestTimeout( function() { 1074 if ( $el.data( 'isotope' ) ) { 1075 $el.isotope( 'layout' ); 1076 } 1077 delete self.resizeTimer; 1078 }, 600 ); 1079 } 1080 }; 1081 1082 // expose to scope 1083 $.extend( theme, { 1084 Masonry: Masonry 1085 } ); 1086 1087 // jquery plugin 1088 $.fn.themeMasonry = function( opts ) { 1089 return this.map( function() { 1090 var $this = $( this ); 1091 imagesLoaded( this, function() { 1092 if ( $this.data( instanceName ) ) { 1093 return $this.data( instanceName ); 1094 } else { 1095 return new theme.Masonry( $this, opts ); 1096 } 1097 } ); 1098 1099 } ); 1100 } 1101 1102} ).apply( this, [window.theme, jQuery] ); 1103 1104 1105// Toggle 1106( function( theme, $ ) { 1107 'use strict'; 1108 1109 theme = theme || {}; 1110 1111 var instanceName = '__toggle'; 1112 1113 var Toggle = function( $el, opts ) { 1114 return this.initialize( $el, opts ); 1115 }; 1116 1117 Toggle.defaults = { 1118 1119 }; 1120 1121 Toggle.prototype = { 1122 initialize: function( $el, opts ) { 1123 if ( $el.data( instanceName ) ) { 1124 return this; 1125 } 1126 1127 this.$el = $el; 1128 1129 this 1130 .setData() 1131 .setOptions( opts ) 1132 .build(); 1133 1134 return this; 1135 }, 1136 1137 setData: function() { 1138 this.$el.data( instanceName, this ); 1139 1140 return this; 1141 }, 1142 1143 setOptions: function( opts ) { 1144 this.options = $.extend( true, {}, Toggle.defaults, opts, { 1145 wrapper: this.$el 1146 } ); 1147 1148 return this; 1149 }, 1150 1151 build: function() { 1152 var $el = this.options.wrapper; 1153 1154 if ( $el.hasClass( 'active' ) ) 1155 $el.find( "> div.toggle-content" ).stop().slideDown( 350, function() { 1156 $( this ).attr( 'style', '' ).show(); 1157 } ); 1158 1159 $el.on( 'click', "> label", function( e ) { 1160 var parentSection = $( this ).parent(), 1161 parentWrapper = $( this ).closest( "div.toogle" ), 1162 parentToggles = $( this ).closest( ".porto-toggles" ), 1163 isAccordion = parentWrapper.hasClass( "toogle-accordion" ), 1164 toggleContent = parentSection.find( "> div.toggle-content" ); 1165 1166 if ( isAccordion && typeof ( e.originalEvent ) != "undefined" ) { 1167 parentWrapper.find( "section.toggle.active > label" ).trigger( "click" ); 1168 } 1169 1170 // Preview Paragraph 1171 if ( !parentSection.hasClass( "active" ) ) { 1172 if ( parentToggles.length ) { 1173 if ( parentToggles.data( 'view' ) == 'one-toggle' ) { 1174 parentToggles.find( '.toggle' ).each( function() { 1175 $( this ).removeClass( 'active' ); 1176 $( this ).find( "> div.toggle-content" ).stop().slideUp( 350, function() { 1177 $( this ).attr( 'style', '' ).hide(); 1178 } ); 1179 } ); 1180 } 1181 } 1182 toggleContent.stop().slideDown( 350, function() { 1183 $( this ).attr( 'style', '' ).show(); 1184 theme.refreshVCContent( toggleContent ); 1185 } ); 1186 parentSection.addClass( "active" ); 1187 } else { 1188 if ( !parentToggles.length || parentToggles.data( 'view' ) != 'one-toggle' ) { 1189 toggleContent.stop().slideUp( 350, function() { 1190 $( this ).attr( 'style', '' ).hide(); 1191 } ); 1192 parentSection.removeClass( "active" ); 1193 } 1194 } 1195 } ); 1196 1197 return this; 1198 } 1199 }; 1200 1201 // expose to scope 1202 $.extend( theme, { 1203 Toggle: Toggle 1204 } ); 1205 1206 // jquery plugin 1207 $.fn.themeToggle = function( opts ) { 1208 return this.map( function() { 1209 var $this = $( this ); 1210 1211 if ( $this.data( instanceName ) ) { 1212 return $this.data( instanceName ); 1213 } else { 1214 return new theme.Toggle( $this, opts ); 1215 } 1216 1217 } ); 1218 } 1219 1220} ).apply( this, [window.theme, jQuery] ); 1221 1222 1223// Sticky 1224( function( theme, $ ) { 1225 'use strict'; 1226 1227 // jQuery Pin plugin 1228 $.fn.themePin = function( options ) { 1229 var scrollY = 0, lastScrollY = 0, elements = [], disabled = false, $window = $( window ), fixedSideTop = [], fixedSideBottom = [], prevDataTo
1229= []; 1230 1231 options = options || {}; 1232 1233 var recalculateLimits = function() { 1234 for ( var i = 0, len = elements.length; i < len; i++ ) { 1235 var $this = elements[i]; 1236 if ( options.minWidth && window.innerWidth < options.minWidth ) { 1237 if ( $this.parent().hasClass( "pin-wrapper" ) ) { 1238 if ( options.hasWrap ) { 1239 // $this.parent().removeClass( "pin-wrapper" ); 1240 $this.parent().css( 'height', '' ); 1241 } else { 1242 $this.unwrap(); 1243 } 1244 1245 } 1246 $this.css( { width: "", left: "", top: "", position: "" } ); 1247 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1248 $this.removeClass( 'sticky-transition' ); 1249 $this.removeClass( 'sticky-absolute' ); 1250 disabled = true; 1251 continue; 1252 } else { 1253 disabled = false; 1254 } 1255 1256 var $container = options.containerSelector ? ( $this.closest( options.containerSelector ).length ? $this.closest( options.containerSelector ) : $( options.containerSelector ) ) : $( document.body ), 1257 offset = $this.offset(); 1258 if ( options.hasWrap && $container.height() < $this.closest( '.pin-wrapper' ).outerHeight() ) { // for sticky side header 1259 $container = $this.closest( '.pin-wrapper' ); 1260 } 1261 var containerOffset = $container.offset(); 1262 1263 if ( typeof containerOffset == 'undefined' ) { 1264 continue; 1265 } 1266 1267 var parentOffset = $this.parent().offset(); 1268 1269 if ( !$this.parent().hasClass( "pin-wrapper" ) ) { 1270 $this.wrap( "<div class='pin-wrapper'>" ); 1271 if ( $this.hasClass( 'elementor-element-populated' ) ) { 1272 var $el_cont = $this.closest( '.elementor-container' ); 1273 if ( $el_cont.length ) { 1274 var matches = $el_cont.attr( 'class' ).match( /elementor-column-gap-([a-z]*)/g ); 1275 if ( matches && matches.length ) { 1276 var gap = matches[0].replace( 'elementor-column-gap-', '' ); 1277 $this.addClass( 'porto-gap-' + gap ); 1278 } 1279 } 1280 } 1281 } 1282 1283 var pad = $.extend( { 1284 top: 0, 1285 bottom: 0 1286 }, options.padding || {} ); 1287 1288 var $pin = $this.parent(), 1289 pt = parseInt( $pin.parent().css( 'padding-top' ) ), pb = parseInt( $pin.parent().css( 'padding-bottom' ) ); 1290 1291 if ( options.autoInit ) { 1292 if ( $( '#header' ).hasClass( 'header-side' ) ) { 1293 pad.top = theme.adminBarHeight(); 1294 /*if ($('.page-top.fixed-pos').length) { 1295 pad.top += $('.page-top.fixed-pos').height(); 1296 }*/ 1297 } else { 1298 pad.top = theme.adminBarHeight(); 1299 if ( $( '#header > .main-menu-wrap' ).length || !$( '#header' ).hasClass( 'sticky-menu-header' ) ) { 1300 pad.top += ( theme.StickyHeader.sticky_height ? theme.StickyHeader.sticky_height : 0 ); 1301 } 1302 } 1303 if ( typeof options.paddingOffsetTop != 'undefined' ) { 1304 pad.top += parseInt( options.paddingOffsetTop, 10 ); 1305 } else { 1306 pad.top += 18; 1307 } 1308 if ( typeof options.paddingOffsetBottom != 'undefined' ) { 1309 pad.bottom = parseInt( options.paddingOffsetBottom, 10 ); 1310 } else { 1311 pad.bottom = 0; 1312 } 1313 } 1314 1315 var bb = $this.css( 'border-bottom' ), h = $this.outerHeight(); 1316 $this.css( 'border-bottom', '1px solid transparent' ); 1317 var o_h = $this.outerHeight() - h - 1; 1318 $this.css( 'border-bottom', bb ); 1319 $this.css( { width: $this.outerWidth() <= $pin.width() ? $this.outerWidth() : $pin.width() } ); 1320 $pin.css( "height", $this.outerHeight() + o_h ); 1321 1322 if ( ( !options.autoFit && !options.fitToBottom ) || $this.outerHeight() <= $window.height() ) { 1323 $this.data( "themePin", { 1324 pad: pad, 1325 from: ( options.containerSelector ? containerOffset.top : offset.top ) - pad.top + pt, 1326 pb: pb, 1327 parentTop: parentOffset.top - pt, 1328 offset: o_h, 1329 stickyOffset: options.stickyOffset ? options.stickyOffset : 0 1330 } ); 1331 } else { 1332 $this.data( "themePin", { 1333 pad: pad, 1334 fromFitTop: ( options.containerSelector ? containerOffset.top : offset.top ) - pad.top + pt, 1335 from: ( options.containerSelector ? containerOffset.top : offset.top ) + $this.outerHeight() - window.innerHeight + pt, 1336 pb: pb, 1337 parentTop: parentOffset.top - pt, 1338 offset: o_h, 1339 stickyOffset: options.stickyOffset ? options.stickyOffset : 0 1340 } ); 1341 } 1342 } 1343 }; 1344 1345 var onScroll = function() { 1346 if ( disabled ) { return; } 1347 1348 scrollY = $window.scrollTop(); 1349 1350 var window_height = window.innerHeight || $window.height(); 1351 1352 for ( var i = 0, len = elements.length; i < len; i++ ) { 1353 var $this = $( elements[i] ), 1354 data = $this.data( "themePin" ), 1355 sidebarTop; 1356 1357 let contentWrap = $this.closest( '.porto-products-filter-body' ); 1358 let sidebarWrap = $this.closest( '.sidebar' ); 1359 if ( contentWrap.length && sidebarWrap.length ) { 1360 if ( $.contains( contentWrap[0], sidebarWrap[0] ) && !contentWrap.hasClass( 'opened' ) ) { 1361 continue; 1362 } 1363 } 1364 1365 if ( !data || typeof data.pad == 'undefined' ) { // Removed element 1366 continue; 1367 } 1368 1369 var $container = options.containerSelector ? ( $this.closest( options.containerSelector ).length ? $this.closest( options.containerSelector ) : $( options.containerSelector ) ) : $( document.body ), 1370 isFitToTop = ( !options.autoFit && !options.fitToBottom ) || ( $this.outerHeight() + data.pad.top ) <= window_height; 1371 if ( options.hasWrap && $container.height() < $this.closest( '.pin-wrapper' ).outerHeight() ) { // for sticky
1371side header 1372 $container = $this.closest( '.pin-wrapper' ); 1373 } 1374 data.end = $container.offset().top + $container.height(); 1375 if ( isFitToTop ) { 1376 data.to = $container.offset().top + $container.height() - $this.outerHeight() - data.pad.bottom - data.pb; 1377 } else { 1378 data.to = $container.offset().top + $container.height() - window_height - data.pb; 1379 data.to2 = $container.height() - $this.outerHeight() - data.pad.bottom - data.pb; 1380 } 1381 1382 if ( prevDataTo[i] === 0 ) { 1383 prevDataTo[i] = data.to; 1384 } 1385 1386 if ( isFitToTop ) { 1387 var from = data.from - data.pad.bottom, 1388 to = data.to - data.pad.top - data.offset, 1389 $parent = $this.closest( '.sticky-nav-wrapper' ), 1390 widgetTop; 1391 1392 // Sticky Navigation 1393 if ( $parent.length ) { 1394 widgetTop = $parent.offset().top - data.pad.top; 1395 if ( widgetTop > from ) { 1396 from = widgetTop; 1397 } 1398 } 1399 1400 if ( typeof data.fromFitTop != 'undefined' && data.fromFitTop ) { 1401 from = data.fromFitTop - data.pad.bottom; 1402 } 1403 1404 if ( from + $this.outerHeight() > data.end || from >= to ) { 1405 $this.css( { position: "", top: "", left: "" } ); 1406 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1407 $this.removeClass( 'sticky-transition' ); 1408 $this.removeClass( 'sticky-absolute' ); 1409 continue; 1410 } 1411 if ( scrollY > from + data.stickyOffset && scrollY < to ) { 1412 !( $this.css( "position" ) == "fixed" ) && $this.css( { 1413 left: $this.offset().left, 1414 top: data.pad.top 1415 } ).css( "position", "fixed" ); 1416 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1417 $this.removeClass( 'sticky-transition' ); 1418 $this.removeClass( 'sticky-absolute' ); 1419 } else if ( scrollY >= to ) { 1420 $this.css( { 1421 left: "", 1422 top: to - data.parentTop + data.pad.top 1423 } ).css( "position", "absolute" ); 1424 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1425 if ( $this.hasClass( 'sticky-absolute' ) ) $this.addClass( 'sticky-transition' ); 1426 $this.addClass( 'sticky-absolute' ); 1427 } else { 1428 $this.css( { position: "", top: "", left: "" } ); 1429 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1430 $this.removeClass( 'sticky-transition' ); 1431 $this.removeClass( 'sticky-absolute' ); 1432 } 1433 } else if ( options.fitToBottom ) { 1434 var from = data.from, 1435 to = data.to; 1436 if ( data.from + window_height > data.end || data.from >= to ) { 1437 $this.css( { position: "", top: "", bottom: "", left: "" } ); 1438 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1439 $this.removeClass( 'sticky-transition' ); 1440 $this.removeClass( 'sticky-absolute' ); 1441 continue; 1442 } 1443 if ( scrollY > from && scrollY < to ) { 1444 !( $this.css( "position" ) == "fixed" ) && $this.css( { 1445 left: $this.offset().left, 1446 bottom: data.pad.bottom, 1447 top: "" 1448 } ).css( "position", "fixed" ); 1449 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1450 $this.removeClass( 'sticky-transition' ); 1451 $this.removeClass( 'sticky-absolute' ); 1452 } else if ( scrollY >= to ) { 1453 $this.css( { 1454 left: "", 1455 top: data.to2, 1456 bottom: "" 1457 } ).css( "position", "absolute" ); 1458 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1459 if ( $this.hasClass( 'sticky-absolute' ) ) $this.addClass( 'sticky-transition' ); 1460 $this.addClass( 'sticky-absolute' ); 1461 } else { 1462 $this.css( { position: "", top: "", bottom: "", left: "" } ); 1463 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1464 $this.removeClass( 'sticky-transition' ); 1465 $this.removeClass( 'sticky-absolute' ); 1466 } 1467 } else { // auto fit 1468 var this_height = $this.outerHeight() 1469 if ( prevDataTo[i] != data.to ) { 1470 if ( fixedSideBottom[i] && this_height + $this.offset().top + data.pad.bottom < scrollY + window_height ) { 1471 fixedSideBottom[i] = false; 1472 } 1473 } 1474 if ( ( this_height + data.pad.top + data.pad.bottom ) > window_height || fixedSideTop[i] || fixedSideBottom[i] ) { 1475 var padTop = parseInt( $this.parent().parent().css( 'padding-top' ) ); 1476 // Reset the sideSortables style when scrolling to the top. 1477 if ( scrollY + data.pad.top - padTop <= data.parentTop ) { 1478 $this.css( { position: "", top: "", bottom: "", left: "" } ); 1479 fixedSideTop[i] = fixedSideBottom[i] = false; 1480 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1481 } else if ( scrollY >= data.to ) { 1482 $this.css( { 1483 left: "", 1484 top: data.to2, 1485 bottom: "" 1486 } ).css( "position", "absolute" );
1487 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1488 } else { 1489 1490 // When scrolling down. 1491 if ( scrollY >= lastScrollY ) { 1492 if ( fixedSideTop[i] ) { 1493 1494 // Let it scroll. 1495 fixedSideTop[i] = false; 1496 sidebarTop = $this.offset().top - data.parentTop; 1497 1498 $this.css( { 1499 left: "", 1500 top: sidebarTop, 1501 bottom: "" 1502 } ).css( "position", "absolute" ); 1503 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1504 } else if ( !fixedSideBottom[i] && this_height + $this.offset().top + data.pad.bottom < scrollY + window_height ) { 1505 // Pin the bottom. 1506 fixedSideBottom[i] = true; 1507 1508 !( $this.css( "position" ) == "fixed" ) && $this.css( { 1509 left: $this.offset().left, 1510 bottom: data.pad.bottom, 1511 top: "" 1512 } ).css( "position", "fixed" ); 1513 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1514 } 1515 1516 // When scrolling up. 1517 } else if ( scrollY < lastScrollY ) { 1518 if ( fixedSideBottom[i] ) { 1519 // Let it scroll. 1520 fixedSideBottom[i] = false; 1521 sidebarTop = $this.offset().top - data.parentTop; 1522 1523 /*if ($this.css('position') == 'absolute' && sidebarTop > data.to2) { 1524 sidebarTop = data.to2; 1525 }*/ 1526 $this.css( { 1527 left: "", 1528 top: sidebarTop, 1529 bottom: "" 1530 } ).css( "position", "absolute" ); 1531 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1532 } else if ( !fixedSideTop[i] && $this.offset().top >= scrollY + data.pad.top ) { 1533 // Pin the top. 1534 fixedSideTop[i] = true; 1535 1536 !( $this.css( "position" ) == "fixed" ) && $this.css( { 1537 left: $this.offset().left, 1538 top: data.pad.top, 1539 bottom: '' 1540 } ).css( "position", "fixed" ); 1541 if ( options.activeClass ) { $this.addClass( options.activeClass ); } 1542 } else if ( !fixedSideBottom[i] && fixedSideTop[i] && $this.css( 'position' ) == 'absolute' && $this.offset().top >= scrollY + data.pad.top ) { 1543 fixedSideTop[i] = false; 1544 } 1545 } 1546 } 1547 } else { 1548 // If the sidebar container is smaller than the viewport, then pin/unpin the top when scrolling. 1549 if ( scrollY >= ( data.parentTop - data.pad.top ) ) { 1550 $this.css( { 1551 position: 'fixed', 1552 top: data.pad.top 1553 } ); 1554 } else { 1555 $this.css( { position: "", top: "", bottom: "", left: "" } ); 1556 if ( options.activeClass ) { $this.removeClass( options.activeClass ); } 1557 } 1558 1559 fixedSideTop[i] = fixedSideBottom[i] = false; 1560 } 1561 } 1562 1563 prevDataTo[i] = data.to; 1564 } 1565 1566 lastScrollY = scrollY; 1567 }; 1568 1569 var update = function() { recalculateLimits(); onScroll(); }, 1570 r_timer = null; 1571 1572 this.each( function() { 1573 var $this = $( this ), 1574 data = $this.data( 'themePin' ) || {}; 1575 1576 if ( data && data.update ) { return; } 1577 elements.push( $this ); 1578 $( "img", this ).one( "load", function() { 1579 if ( r_timer ) { 1580 theme.deleteTimeout( r_timer ); 1581 } 1582 r_timer = theme.requestFrame( recalculateLimits ); 1583 } ); 1584 data.update = update; 1585 $this.data( 'themePin', data ); 1586 fixedSideTop.push( false ); 1587 fixedSideBottom.push( false ); 1588 prevDataTo.push( 0 ); 1589 } ); 1590 1591 //$window.on( 'touchmove', onScroll ); 1592 window.addEventListener( 'touchmove', onScroll, { passive: true } ); 1593 window.addEventListener( 'scroll', onScroll, { passive: true } ); 1594 recalculateLimits(); 1595 1596 if ( !theme.isLoaded ) { 1597 $window.on( 'load', update ); 1598 } else { 1599 update(); 1600 } 1601 1602 $( this ).on( 'recalc.pin', function() { 1603 recalculateLimits(); 1604 onScroll(); 1605 } ); 1606 1607 return this; 1608 }; 1609 1610 theme = theme || {}; 1611 1612 var instanceName = '__sticky'; 1613 1614 var Sticky = function( $el, opts ) { 1615 return this.initialize( $el, opts ); 1616 }; 1617 1618 Sticky.defaults = { 1619 autoInit: false, 1620 minWidth: 767, 1621 activeClass: 'sticky-active', 1622 padding: { 1623 top: 0, 1624 bottom: 0 1625 }, 1626 offsetTop: 0, 1627 offsetBottom: 0, 1628 autoFit: false, 1629 fitToBottom: false, 1630 stickyOffset: 0 1631 }; 1632 1633 Sticky.prototype = { 1634 initialize: function( $el, opts ) { 1635 if ( $el.data( instanceName ) ) { 1636 return this; 1637 } 1638 1639 this.$el = $el; 1640 1641 this 1642 .setData() 1643 .setOptions( opts ) 1644 .build(); 1645 1646 return this; 1647 }, 1648 1649 setData: function() { 1650 this.$el.data( instanceName, this ); 1651 1652 return this; 1653 }, 1654 1655 setOptions: function( opts ) { 1656 this.options = $.extend( true, {}, Sticky.defaults, opts, { 1657 wrapper: this.$el 1658 } ); 1659 1660 return this; 1661 }, 1662 1663 build: function() { 1664 if ( !$.fn.themePin ) { 1665 return this; 1666 } 1667 1668 var self = this, 1669 $el = this.options.wrapper, 1670 stickyResizeTrigger; 1671 1672 if ( $el.hasClass( 'porto-sticky-nav' ) ) { 1673 this.options.padding.top = theme.StickyHeader.sticky_height + theme.adminBarHeight(); 1674 this.options.activeClass = 'sticky-active'; 1675 this.options.containerSelector = '.main-content-wrap'; 1676 theme.sticky_nav_height = $el.outerHeight(); 1677 if ( this.options.minWidth > window.innerWidth ) 1678 theme.sticky_nav_height = 0; 1679 1680 var porto_progress_obj = $( '.porto-scroll-progress.fixed-top:not(.fixed-under-header)' ); 1681 if ( porto_progress_obj.length ) { 1682 var flag = false; 1683 if ( porto_progress_obj.is( ':hidden' ) ) { 1684 porto_progress_obj.show(); 1685 flag = true; 1686 } 1687 if ( flag ) { 1688 porto_progress_obj.hide(); 1689 } 1690 } 1691 1692 var offset = theme.adminBarHeight() + theme.StickyHeader.sticky_height - 1, 1693 $transitionOffset = ( offset > 100 ) ? offset : 100; 1694 1695 this.options.stickyOffset = theme.sticky_nav_height + $transitionOffset; 1696 var init_filter_widget_sticky = function() { 1697 var prevScrollPos = $el.data('prev-pos') ? $el.data('prev-pos') : 0, 1698 scrollUpOffset = 0, 1699 objHeight = $el.outerHeight() + parseInt( $el.css( 'margin-bottom' ) ), 1700 scrollTop = $( window ).scrollTop(); 1701 1702 if ( $( '.page-wrapper' ).hasClass( 'sticky-scroll-up' ) ) { 1703 if ( scrollTop >= prevScrollPos ) { 1704 $el.addClass('scroll-down'); 1705 } else { 1706 $el.removeClass('scroll-down'); 1707 } 1708 1709 // Header is scroll-up Sticky Type 1710 scrollUpOffset = - theme.StickyHeader.sticky_height; 1711 if ( 'undefined' == typeof ( theme.StickyHeader.sticky_height ) ) { 1712 $el.data( 'prev-pos', 0 ); 1713 } else { 1714 // The transition of Sticky isn't working in this area 1715 if ( $el.parent().offset().top + objHeight + $transitionOffset < scrollTop + offset + scrollUpOffset ) { 1716 $el.addClass( 'sticky-ready' ); 1717 } else { 1718 $el.removeClass( 'sticky-ready' ); 1719 } 1720 $el.data( 'prev-pos', scrollTop ); 1721 } 1722 } 1723 } 1724 1725 if ( this.options.minWidth <= window.innerWidth ) { 1726 window.removeEventListener( 'scroll', init_filter_widget_sticky ); 1727 window.addEventListener( 'scroll', init_filter_widget_sticky, { passive: true } ); 1728 init_filter_widget_sticky(); 1729 } 1730 } 1731 1732 $el.themePin( this.options ); 1733 1734 $( window ).smartresize( function() { 1735 if ( stickyResizeTrigger ) { 1736 clearTimeout( stickyResizeTrigger ); 1737 } 1738 stickyResizeTrigger = setTimeout( function() {
1739 $el.trigger( 'recalc.pin' ); 1740 }, 800 ); 1741 1742 var $parent = $el.parent(); 1743 1744 $el.outerWidth( $parent.width() ); 1745 if ( $el.css( 'position' ) == 'fixed' ) { 1746 $el.css( 'left', $parent.offset().left ); 1747 } 1748 1749 if ( $el.hasClass( 'porto-sticky-nav' ) ) { 1750 theme.sticky_nav_height = $el.outerHeight(); 1751 if ( self.options.minWidth > window.innerWidth ) 1752 theme.sticky_nav_height = 0; 1753 } 1754 } ); 1755 1756 return this; 1757 } 1758 }; 1759 1760 // expose to scope 1761 $.extend( theme, { 1762 Sticky: Sticky 1763 } ); 1764 1765 // jquery plugin 1766 $.fn.themeSticky = function( opts ) { 1767 return this.map( function() { 1768 var $this = $( this ); 1769 if ( $this.data( instanceName ) ) { 1770 $this.trigger( 'recalc.pin' ); 1771 setTimeout( function() { 1772 $this.trigger( 'recalc.pin' ); 1773 }, 800 ); 1774 1775 return $this.data( instanceName ); 1776 } else { 1777 return new theme.Sticky( $this, opts ); 1778 } 1779 1780 } ); 1781 } 1782 1783} ).apply( this, [window.theme, jQuery] ); 1784 1785 1786// Mobile Panel 1787( function( theme, $ ) { 1788 'use strict'; 1789 1790 $( function() { 1791 $( document.body ).on( 'click', '.mobile-toggle', function( e ) { 1792 var $nav_panel = $( '#nav-panel' ); 1793 if ( $nav_panel.length > 0 ) { 1794 if ( $( this ).closest( '.header-main' ).length && $nav_panel.closest( '.header-builder-p' ).length && !$nav_panel.parent( '.header-main' ).length ) { 1795 $nav_panel.appendTo( $( this ).closest( '.header-main' ) ); 1796 } else if ( $( this ).closest( '.header-main' ).length && $nav_panel.closest( '.wp-block-template-part' ).length ) { 1797 $nav_panel.insertAfter( $( this ).closest( '.header-main' ) ); 1798 } 1799 1800 if ( $nav_panel.is( ':visible' ) && $( '#header' ).hasClass( 'sticky-header' ) ) { 1801 var h_h = $( '#header' ).height(), p_h = $nav_panel.outerHeight(); 1802 if ( h_h > p_h + 30 ) { 1803 $( '#header' ).css( 'height', h_h - p_h ); 1804 } 1805 } 1806 $nav_panel.stop().slideToggle(); 1807 } else if ( $( '#side-nav-panel' ).length > 0 ) { 1808 $( 'html' ).toggleClass( 'panel-opened' ); 1809 $( '.panel-overlay' ).toggleClass( 'active' ); 1810 if ( $( '#side-nav-panel' ).hasClass( 'panel-right' ) ) { 1811 $( 'html' ).addClass( 'panel-right-opened' ); 1812 } 1813 } 1814 if ( $( '#nav-panel .skeleton-body, #side-nav-panel .skeleton-body' ).length ) { 1815 theme.lazyload_menu( 1, 'mobile_menu' ); 1816 } 1817 e.preventDefault(); 1818 } ); 1819 1820 $( document.body ).on( 'click', '.panel-overlay', function() { 1821 $( 'html' ).css( 'transition', 'margin .3s' ).removeClass( 'panel-opened' ).removeClass( 'panel-right-opened' ); 1822 theme.requestTimeout( function() { 1823 $( 'html' ).css( 'transition', '' ); 1824 }, 260 ); 1825 $( this ).removeClass( 'active' ); 1826 } ); 1827 1828 $( document.body ).on( 'click', '.side-nav-panel-close', function( e ) { 1829 e.preventDefault(); 1830 $( '.panel-overlay' ).trigger( 'click' ); 1831 } ); 1832 1833 $( document.body ).on( 'click', '#side-nav-panel .mobile-tab-items .nav-item', function( e ) { 1834 e.preventDefault(); 1835 var $this = $( this ), 1836 $id = $this.attr('pane-id'), 1837 $parent = $this.closest('.mobile-tabs'); 1838 1839 if ( $id ) { 1840 $parent.find('.active').removeClass( 'active' ); 1841 $this.addClass('active'); 1842 $parent.find('.mobile-tab-content [tab-id="' + $id + '"]').addClass( 'active' ); 1843 } 1844 } ); 1845 1846 $( window ).on( 'resize', function() { 1847 if ( window.innerWidth > 991 ) { 1848 $( '#nav-panel' ).hide(); 1849 if ( $( 'html' ).hasClass( 'panel-opened' ) ) { 1850 $( '.panel-overlay' ).trigger( 'click' ); 1851 } 1852 } 1853 } ); 1854 } ); 1855 1856} ).apply( this, [window.theme, jQuery] ); 1857 1858// Scroll to Top 1859 1860//** jQuery Scroll to Top Control script- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com. 1861//** Available/ usage terms at http://www.dynamicdrive.com (March 30th, 09') 1862//** v1.1 (April 7th, 09'): 1863//** 1) Adds ability to scroll to an absolute position (from top of page) or specific element on the page instead. 1864//** 2) Fixes scroll animation not working in Opera. 1865 1866 1867var scrolltotop = { 1868 //startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control 1869 //scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top). 1870 setting: { startline: 100, scrollto: 0, scrollduration: 1000, fadeduration: [500, 100] }, 1871 controlHTML: '<img src="assets/img/up.png" style="width:40px; height:40px" />
1871', //HTML for control, which is auto wrapped in DIV w/ ID="topcontrol" 1872 controlattrs: { offsetx: 10, offsety: 10 }, //offset of control relative to right/ bottom of window corner 1873 anchorkeyword: '#top', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links 1874 1875 state: { isvisible: false, shouldvisible: false }, 1876 1877 scrollup: function() { 1878 if ( !this.cssfixedsupport ) //if control is positioned using JavaScript 1879 this.$control.css( { opacity: 0 } ); //hide control immediately after clicking it 1880 var dest = isNaN( this.setting.scrollto ) ? this.setting.scrollto : parseInt( this.setting.scrollto ); 1881 if ( typeof dest == "string" && jQuery( '#' + dest ).length == 1 ) //check element set by string exists 1882 dest = jQuery( '#' + dest ).offset().top; 1883 else 1884 dest = 0; 1885 this.$body.stop().animate( { scrollTop: dest }, this.setting.scrollduration ); 1886 }, 1887 1888 keepfixed: function() { 1889 var $window = jQuery( window ); 1890 var controlx = $window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx; 1891 var controly = $window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety; 1892 this.$control.css( { left: controlx + 'px', top: controly + 'px' } ); 1893 }, 1894 1895 togglecontrol: function() { 1896 var scrolltop = jQuery( window ).scrollTop(); 1897 if ( !this.cssfixedsupport ) 1898 this.keepfixed(); 1899 this.state.shouldvisible = ( scrolltop >= this.setting.startline ) ? true : false; 1900 if ( this.state.shouldvisible && !this.state.isvisible ) { 1901 this.$control.stop().animate( { opacity: 1 }, this.setting.fadeduration[0] ); 1902 this.state.isvisible = true; 1903 } 1904 else if ( this.state.shouldvisible == false && this.state.isvisible ) { 1905 this.$control.stop().animate( { opacity: 0 }, this.setting.fadeduration[1] ); 1906 this.state.isvisible = false; 1907 } 1908 }, 1909 1910 init: function() { 1911 jQuery( document ).ready( function( $ ) { 1912 var mainobj = scrolltotop; 1913 var iebrws = document.all; 1914 mainobj.cssfixedsupport = !iebrws || iebrws && document.compatMode == "CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode 1915 mainobj.$body = ( window.opera ) ? ( document.compatMode == "CSS1Compat" ? $( 'html' ) : $( 'body' ) ) : $( 'html,body' ); 1916 mainobj.$control = $( '<div id="topcontrol">' + mainobj.controlHTML + '</div>' ) 1917 .css( { position: mainobj.cssfixedsupport ? 'fixed' : 'absolute', bottom: mainobj.controlattrs.offsety, opacity: 0, cursor: 'pointer' } ) 1918 .attr( { title: '' } ) 1919 .on( 'click', function() { mainobj.scrollup(); return false; } ) 1920 .appendTo( 'body' ); 1921 if ( document.all && !window.XMLHttpRequest && mainobj.$control.text() != '' ) //loose check for IE6 and below, plus whether control contains any text 1922 mainobj.$control.css( { width: mainobj.$control.width() } ); //IE6- seems to require an explicit width on a DIV containing text 1923 mainobj.togglecontrol(); 1924 $( 'a[href="' + mainobj.anchorkeyword + '"]' ).on( 'click', function() { 1925 mainobj.scrollup(); 1926 return false; 1927 } ); 1928 $( window ).on( 'scroll resize', function( e ) { 1929 mainobj.togglecontrol(); 1930 } ); 1931 } ); 1932 } 1933}; 1934 1935//scrolltotop.init() 1936 1937( function( theme, $ ) { 1938 'use strict'; 1939 theme = theme || {}; 1940 1941 $.extend( theme, { 1942 1943 ScrollToTop: { 1944 1945 defaults: { 1946 html: '<i class="fas fa-chevron-up"></i>', 1947 offsetx: 10, 1948 offsety: 0 1949 }, 1950 1951 initialize: function( html, offsetx, offsety ) { 1952 if ( $( '#topcontrol' ).length ) { 1953 return this; 1954 } 1955 this.html = ( html || this.defaults.html ); 1956 this.offsetx = ( offsetx || this.defaults.offsetx ); 1957 this.offsety = ( offsety || this.defaults.offsety ); 1958 1959 this.build(); 1960 1961 return this; 1962 }, 1963 1964 build: function() { 1965 var self = this; 1966 1967 if ( typeof scrolltotop !== 'undefined' ) { 1968 // scroll top control 1969 scrolltotop.controlHTML = self.html; 1970 scrolltotop.controlattrs = { offsetx: self.offsetx, offsety: self.offsety }; 1971 scrolltotop.init(); 1972 } 1973 1974 return self; 1975 } 1976 } 1977 1978 } ); 1979 1980} ).apply( this, [window.theme, jQuery] ); 1981 1982 1983// Mega Menu 1984( function( theme, $ ) { 1985 'use strict'; 1986 1987 theme = theme || {}; 1988 1989 $.extend( theme, { 1990 1991 MegaMenu: { 1992 1993 defaults: { 1994 menu: $( '.mega-menu' ) 1995 }, 1996 1997 initialize: function( $menu ) { 1998 this.$menu = ( $menu || this.defaults.menu ); 1999 2000 this.events(); // Include the build function 2001 2002 return this; 2003 }, 2004 2005 popupWidth: function() { 2006 var winWidth = window.innerWidth, 2007 popupWidth = theme.bodyWidth - theme.grid_gutter_width * 2; 2008 if ( !$( 'body' ).hasClass( 'wide' ) ) { 2009 if ( winWidth >= 1140 + theme.grid_gutter_width && winWidth <= theme.container_width + 2 * theme.grid_gutter_width - 1 && theme.container_width >= 1360 ) 2010 popupWidth = 1140 - theme.grid_gutter_width; 2011 else if ( winWidth >= theme.container_width + theme.grid_gutter_width - 1 ) 2012 popupWidth = theme.container_width - theme.grid_gutter_width; 2013 else if ( winWidth >= 992 ) 2014 popupWidth = 960 - theme.grid_gutter_width; 2015 else if ( winWidth >= 768 ) 2016 popupWidth = 720 - theme.grid_gutter_width; 2017 } 2018 return popupWidth; 2019 }, 2020 2021 calcMenuPosition: function( menu_obj, is_left ) { 2022 var menu = menu_obj, 2023 $menuWrap; 2024 2025 if ( $( menu ).closest( '.elementor-top-section' ).length ) { 2026 // Elementor Section 2027 $menuWrap = $( menu ).closest( '.elementor-top-section' ); 2028 } else if ( $( menu ).closest( '.e-con.e-parent' ).length ) { 2029 // Elementor Container 2030 $menuWrap = $( menu ).closest( '.e-con.e-parent' ); 2031 } else if ( $( menu ).closest( '.e-con' ).length ) { 2032 // Elementor Container 2033 $menuWrap = $( menu ).closest( '.e-con' ); 2034 } else if ( $( menu ).closest( '.header-main' ).length ) { 2035 // Header Type 2036 $menuWrap = $( menu ).closest( '.header-main' ); 2037 } else if ( $( menu ).closest( '.main-menu-wrap' ).length ) { 2038 // Customize header builder & header type 2039 $menuWrap = $( menu ).closest( '.main-menu-wrap' ); 2040 } else if ( $( menu ).closest( '.header-top' ).length ) { 2041 // Customize header builder 2042 $menuWrap = $( menu ).closest( '.header-top' ); 2043 } else if ( $( menu ).closest( '.header-bottom' ).length ) { 2044 // Customize header builder 2045 $menuWrap = $( menu ).closest( '.header-bottom' ); 2046 } else { 2047 // Built with WPBakery 2048 $menuWrap = $( menu ).closest( '.top-row' ); 2049 } 2050 2051 var $headerContainer = $menuWrap; 2052 var ctSpacing = 0; 2053 if ( $menuWrap.children( '.elementor-container' ).length ) { 2054 $headerContainer = $menuWrap.children( '.elementor-container' ); 2055 } else if ( $menuWrap.find( '.container-fluid' ).length ) { 2056 $headerContainer = $menuWrap.find( '.container-fluid' ); 2057 } else if ( $menuWrap.find( '.container' ).length ) { 2058 $headerContainer = $menuWrap.find( '.container' ); 2059 } else if ( $menuWrap.find( '.e-con-inner' ).length ) { 2060 $headerContainer = $menuWrap.find( '.e-con-inner' ); 2061 } else if ( $menuWrap.find( '.vc_column_container' ).length ) { 2062 ctSpacing = 2 * parseInt( $menuWrap.find( '.vc_column_container' ).css( 'padding-left' ) ); 2063 // $headerContainer = $menuWrap.find( '.vc_column_container' ); 2064 } 2065 2066 if ( $headerContainer.length >= 1 ) { 2067 var isParent = false; 2068 $headerContainer.each( function () { 2069 var $this = $(this); 2070 if ( $this.find( menu ).length && ! isParent ) { 2071 $headerContainer = $this; 2072 isParent = true; 2073 } 2074 } ); 2075 if ( ! isParent ) { 2076 $headerContainer = $menuWrap; 2077 } 2078 } 2079 if ( ! $headerContainer.length ) { 2080 return; 2081 } 2082 2083 var menuContainerWidth = $headerContainer.outerWidth() - parseInt( $headerContainer.css( 'padding-left' ) ) - parseInt( $headerContainer.css( 'padding-right' ) ) - ctSpacing; 2084 if ( menuContainerWidth < 900 ) return; 2085 if ( menu.parent().hasClass( 'pos-fullwidth' ) ) { 2086 menu.get( 0 ).style.width = menuContainerWidth + 'px'; 2087 } 2088 var browserWidth = document.body.offsetWidth, 2089 menuLeftPos = menu.offset().left - ( ( browserWidth - menuContainerWidth ) / 2 ), 2090 l = false; 2091 2092 if ( 'center' == is_left ) { 2093 var remainWidth = menuContainerWidth - ( menuLeftPos + menu.width() ); 2094 if ( remainWidth <= 0 ) { 2095 l = remainWidth; 2096 } else if ( menuLeftPos <= 0 ) { 2097 l = -menuLeftPos; 2098 } 2099 } else if ( 'justify' == is_left ) { 2100 if ( window.theme.rtl ) { 2101 menuLeftPos = browserWidth - ( menu.offset().left + menu.outerWidth() ) - ( browserWidth - menuContainerWidth ) / 2; 2102 } 2103 var menuWidth = menu.width(), 2104 remainWidth = menuContainerWidth - ( menuLeftPos + menuWidth ); 2105 if ( menuLeftPos > remainWidth && menuLeftPos < menuWidth ) { 2106 l = ( menuLeftPos + remainWidth ) / 3; 2107 } 2108 if ( remainWidth <= 0 ) { 2109 l = -remainWidth; 2110 } 2111 } else if ( false !== is_left ) { 2112 var remainWidth = menuContainerWidth - ( menuLeftPos + menu.width() ); 2113 if ( remainWidth <= 0 ) { 2114 l = -remainWidth; 2115 } 2116 } else if ( menuLeftPos <= 0 ) { 2117 l = -menuLeftPos; 2118 } 2119 return l; 2120 }, 2121 2122 build: function( $menu ) { 2123 var self = this; 2124 if ( !$menu ) { 2125 $menu = self.$menu; 2126 } 2127 2128 $menu.each( function() { 2129 var $menu = $( this ), 2130 $menu_container = $menu.closest( '.container' ), 2131 container_width = self.popupWidth(); 2132 if ( $menu.closest( '.porto-popup-menu' ).length ) { 2133 return false; 2134 } 2135 2136 var $menu_items = $menu.children( 'li.has-sub' ); 2137 2138 $menu_items.each( function() { 2139 var $menu_item = $( this ), 2140 $popup = $menu_item.children( '.popup' ); 2141 if ( $popup.length ) { 2142 var popup_obj = $popup.get( 0 ); 2143 popup_obj.style.display = 'block'; 2144 if ( $menu_item.hasClass( 'wide' ) ) { 2145 popup_obj.style.left = 0; 2146 var padding = parseInt( $popup.css( 'padding-left' ) ) + parseInt( $popup.css( 'padding-right' ) ) + 2147 parseInt( $popup.find( '> .inner' ).css( 'padding-left' ) ) + parseInt( $popup.find( '> .inner' ).css( 'padding-right' ) ); 2148 2149 var row_number = 4; 2150 2151 if ( $menu_item.hasClass( 'col-1' ) ) row_number = 1; 2152 if ( $menu_item.hasClass( 'col-2' ) ) row_number = 2; 2153 if ( $menu_item.hasClass( 'col-3' ) ) row_number = 3; 2154 if ( $menu_item.hasClass( 'col-4' ) ) row_number = 4; 2155 if ( $menu_item.hasClass( 'col-5' ) ) row_number = 5; 2156 if ( $menu_item.hasClass( 'col-6' ) ) row_number = 6; 2157 2158 if ( window.innerWidth < 992 ) 2159 row_number = 1; 2160 2161 var col_length = 0; 2162 $popup.find( '> .inner > ul > li' ).each( function() { 2163 var cols = parseFloat( $( this ).attr( 'data-cols' ) ); 2164 if ( cols <= 0 || !cols ) 2165 cols = 1; 2166 2167 if ( cols > row_number ) 2168 cols = row_number; 2169 2170 col_length += cols; 2171 } ); 2172 2173 if ( col_length > row_number ) col_length = row_number; 2174 2175 var popup_max_width = $popup.data( 'popup-mw' ) ? $popup.data( 'popup-mw' ) : $popup.find( '.inner' ).css( 'max-width' ), 2176 col_width = container_width / row_number; 2177 if ( 'none' !== popup_max_width && parseInt( popup_max_width ) < container_width ) { 2178 col_width = parseInt( popup_max_width ) / row_number; 2179 } 2180 2181 $popup.find( '> .inner > ul > li' ).each( function() { 2182 var cols = parseFloat( $( this ).data( 'cols' ) ); 2183 if ( cols <= 0 ) 2184 cols = 1; 2185 2186 if ( cols > row_number ) 2187 cols = row_number; 2188 2189 if ( $menu_item.hasClass( 'pos-center' ) || $menu_item.hasClass( 'pos-left' ) || $menu_item.hasClass( 'pos-right' ) ) 2190 this.style.width = ( 100 / col_length * cols ) + '%'; 2191 else 2192 this.style.width = ( 100 / row_number * cols ) + '%'; 2193 } ); 2194 2195 if ( $menu_item.hasClass( 'pos-center' ) ) { // position center 2196 var width = col_width * col_length - padding; 2197 $popup.find( '> .inner > ul' ).get( 0 ).style.width = width + 'px'; 2198 var left_position = ( $menu_item.outerWidth() - width ) / 2; 2199 popup_obj.style.left = left_position + 'px'; 2200 popup_obj.style.right = 'auto'; 2201 self.SetMenuPosition( popup_obj, $popup, 'center', left_position ); 2202 } else if ( $menu_item.hasClass( 'pos-left' ) ) { // position left 2203 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( col_width * col_length - padding ) + 'px'; 2204 popup_obj.style.left = '0'; 2205 popup_obj.style.right = 'auto'; 2206 self.SetMenuPosition( popup_obj, $popup ); 2207 } else if ( $menu_item.hasClass( 'pos-right' ) ) { // position right 2208 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( col_width * col_length - padding ) + 'px'; 2209 popup_obj.style.right = '0'; 2210 popup_obj.style.left = 'auto'; 2211 self.SetMenuPosition( popup_obj, $popup, false ); 2212 } else if ( $menu_item.hasClass( 'pos-fullwidth' ) ) { 2213 popup_obj.style.right = 'auto'; 2214 popup_obj.style.left = '0'; 2215 self.SetMenuPosition( popup_obj, $popup ); 2216 } else { 2217 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( container_width - padding ) + 'px'; 2218 if ( theme.rtl ) { 2219 popup_obj.style.right = '0'; 2220 popup_obj.style.left = 'auto'; 2221 } else { 2222 popup_obj.style.left = '0'; 2223 popup_obj.style.right = 'auto'; 2224 } 2225 self.SetMenuPosition( popup_obj, $popup, 'justify' ); 2226 } 2227 } else { // auto position 2228 if ( $menu_item.hasClass( 'pos-left' ) ) { // position left 2229 if ( $popup.offset().left + $popup.width() > window.innerWidth ) { 2230 $menu_item.removeClass( 'pos-left' ).addClass( 'pos-right' ); 2231 } 2232 } else if ( $menu_item.hasClass( 'pos-right' ) ) { // position right 2233 if ( $popup.offset().left < 0 ) { 2234 $menu_item.removeClass( 'pos-right' ).addClass( 'pos-left' ); 2235 } 2236 } else { // position justify 2237 if ( $popup.offset().left + $popup.width() > window.innerWidth ) { 2238 $menu_item.addClass( 'pos-right' ); 2239 } else if ( $popup.find( '> .inner > ul' ).length ) { 2240 var $sub_menu = $popup.find( '> .inner > ul' ).eq( 0 ); 2241 if ( $sub_menu.offset().left + $sub_menu.width() + 200 > window.innerWidth ) { 2242 $sub_menu.addClass( 'pos-left' ); 2243 } 2244 } 2245 } 2246 } 2247 $menu_item.addClass( 'sub-ready' ); 2248 } 2249 } ); 2250 } ); 2251 2252 return self; 2253 }, 2254 2255 SetMenuPosition: function ( popup_obj, $popup, is_left = true, offsetWidth = 0 ) { 2256 setTimeout( () => { 2257 var self = this, 2258 left_position = self.calcMenuPosition( $popup, is_left ); 2259 if ( 0 !== left_position ) { 2260 if ( 'center' == is_left ) { 2261 // Center 2262 if ( false !== left_position ) { 2263 popup_obj.style.left = ( offsetWidth + left_position ) + 'px'; 2264 popup_obj.style.right = 'auto'; 2265 } 2266 } else if ( 'justify' == is_left ) { 2267 if ( theme.rtl ) { 2268 popup_obj.style.left = 'auto'; 2269 if ( left_position ) { 2270 popup_obj.style.right = '-' + left_position + 'px'; 2271 } else { 2272 if ( ! $( 'body' ).hasClass( 'wide' ) ) { 2273 popup_obj.style.right = '-15px'; 2274 } else { 2275 popup_obj.style.right = '0'; 2276 } 2277 } 2278 } else { 2279 popup_obj.style.right = 'auto'; 2280 if ( left_position ) { 2281 popup_obj.style.left = '-' + left_position + 'px'; 2282 } else { 2283 if ( ! $( 'body' ).hasClass( 'wide' ) ) { 2284 popup_obj.style.left = '-15px'; 2285 } else { 2286 popup_obj.style.left = '0'; 2287 } 2288 } 2289 } 2290 } else { 2291 if ( is_left ) { 2292 popup_obj.style.right = 'auto'; 2293 if ( false !== left_position ) { 2294 popup_obj.style.left = '-' + left_position + 'px'; 2295 } else { 2296 if ( ! $( 'body' ).hasClass( 'wide' ) ) { 2297 popup_obj.style.left = '-15px'; 2298 } else { 2299 popup_obj.style.left = '0';�
2299 2300 } 2301 } 2302 } else { 2303 popup_obj.style.left = 'auto'; 2304 if ( false !== left_position ) { 2305 popup_obj.style.right = '-' + left_position + 'px'; 2306 } else { 2307 if ( ! $( 'body' ).hasClass( 'wide' ) ) { 2308 popup_obj.style.right = '-15px'; 2309 } else { 2310 popup_obj.style.right = '0'; 2311 } 2312 } 2313 } 2314 } 2315 } 2316 } ); 2317 }, 2318 2319 events: function() { 2320 var self = this; 2321 2322 $( window ).smartresize( function( e ) { 2323 if ( e.originalEvent ) { 2324 self.build(); 2325 } 2326 } ); 2327 2328 if ( theme.isLoaded ) { 2329 theme.requestFrame( function() { 2330 self.build(); 2331 } ); 2332 } else { 2333 $( window ).on( 'load', function() { 2334 theme.requestFrame( function() { 2335 self.build(); 2336 } ); 2337 } ); 2338 } 2339 2340 if ( self.$menu.length ) { 2341 self.$menu.on( 'mouseenter', '.menu-item.has-sub', function( e ) { 2342 var $thePopup = $( e.currentTarget ).find( '>.popup' ); 2343 if ( $thePopup.find( '.owl-carousel:not(.owl-loaded)' ).length == 0 ) { 2344 return; 2345 } 2346 $thePopup.find( '.owl-carousel:not(.owl-loaded)' ).each( function() { 2347 var $this = $( this ), 2348 opts; 2349 if ( ! $this.hasClass( 'owl-loaded' ) ) { 2350 var pluginOptions = $this.data( 'plugin-options' ); 2351 if ( pluginOptions ) 2352 opts = pluginOptions; 2353 if ( $.fn.themeCarousel ) { 2354 $this.themeCarousel( opts ); 2355 } 2356 } 2357 }); 2358 }); 2359 } 2360 return self; 2361 } 2362 } 2363 2364 } ); 2365 2366} ).apply( this, [window.theme, jQuery] ); 2367 2368 2369// Sticky Header 2370( function( theme, $ ) { 2371 'use strict'; 2372 2373 theme = theme || {}; 2374 2375 $.extend( theme, { 2376 2377 StickyHeader: { 2378 2379 defaults: { 2380 header: $( '#header' ) 2381 }, 2382 2383 initialize: function( $header ) { 2384 this.$header = ( $header || this.defaults.header ); 2385 this.sticky_height = 0; 2386 this.sticky_pos = 0; 2387 this.change_logo = theme.change_logo; 2388 2389 if ( !theme.show_sticky_header || !this.$header.length || $( '.side-header-narrow-bar' ).length ) 2390 return this; 2391 2392 var self = this; 2393 2394 var $menu_wrap = self.$header.find( '> .main-menu-wrap' ); 2395 if ( $menu_wrap.length ) { 2396 self.$menu_wrap = $menu_wrap; 2397 self.menu_height = $menu_wrap.height(); 2398 } else { 2399 self.$menu_wrap = false; 2400 } 2401 2402 self.$header_main = self.$header.find( '.header-main' ); 2403 2404 if ( self.$header_main.length > 1 ) { 2405 self.$header_main = $( self.$header_main[0] ); 2406 } 2407 2408 // fix compatibility issue with Elementor pro header builder 2409 if ( !self.$header_main.length && self.$header.children( '.elementor-location-header' ).length ) { 2410 self.$header_main = self.$header.children( '.elementor-location-header' ).last().addClass( 'header-main' ); 2411 } 2412 2413 if ( !self.$header_main.length ) { 2414 return this; 2415 } 2416 2417 self.reveal = self.$header.parents( '.header-wrapper' ).hasClass( 'header-reveal' ); 2418 2419 self.is_sticky = false; 2420 2421 self.reset() 2422 .build() 2423 .events(); 2424 2425 return self; 2426 }, 2427 2428 build: function() { 2429 var self = this; 2430 2431 if ( !self.is_sticky && ( window.innerHeight + self.header_height + theme.adminBarHeight() + parseInt( self.$header.css( 'border-top-width' ) ) >= $( document ).height() ) ) { 2432 return self; 2433 } 2434 2435 if ( window.innerHeight > $( document.body ).height() ) 2436 window.scrollTo( 0, 0 ); 2437 2438 var scroll_top = $( window ).scrollTop(), 2439 $pageWrapper = $( '.page-wrapper' ); 2440 2441 if ( self.$menu_wrap && !theme.isTablet() ) { 2442 2443 self.$header_main.stop().css( 'top', 0 ); 2444 2445 if ( self.$header.parent().hasClass( 'fixed-header' ) ) 2446 self.$header.parent().attr( 'style', '' ); 2447 2448 // Scroll Up - Header Type 2449 if ( $( '.page-wrapper' ).hasClass( 'sticky-scroll-up' ) ) { 2450 scroll_top -= self.sticky_height; 2451 if ( scroll_top > self.sticky_pos + 100 ) { 2452 self.$header.addClass( 'sticky-ready' ); 2453 } else { 2454 self.$header.removeClass( 'sticky-ready' ); 2455 } 2456 } 2457 if ( scroll_top > self.sticky_pos ) { 2458 if ( !self.$header.hasClass( 'sticky-header' ) && ( ! $pageWrapper.hasClass( 'sticky-scroll-up' ) || ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && 'undefined' !== typeof ( $pageWrapper.data( 'prev-scrollpos' ) ) ) ) ) { 2459 var header_height = self.$header.outerHeight(); 2460 self.$header.addClass( 'sticky-header' ).css( 'height', header_height );
2461 self.$menu_wrap.stop().css( 'top', theme.adminBarHeight() ); 2462 2463 var selectric = self.$header.find( '.header-main .searchform select' ).data( 'selectric' ); 2464 if ( selectric && typeof selectric.close != 'undefined' ) 2465 selectric.close(); 2466 2467 if ( self.$header.parent().hasClass( 'fixed-header' ) ) { 2468 self.$header_main.hide(); 2469 self.$header.css( 'height', '' ); 2470 } 2471 2472 if ( !self.init_toggle_menu ) { 2473 self.init_toggle_menu = true; 2474 theme.MegaMenu.build(); 2475 if ( $( '#main-toggle-menu' ).length ) { 2476 if ( $( '#main-toggle-menu' ).hasClass( 'show-always' ) ) { 2477 $( '#main-toggle-menu' ).data( 'show-always', true ); 2478 $( '#main-toggle-menu' ).removeClass( 'show-always' ); 2479 } 2480 $( '#main-toggle-menu' ).addClass( 'closed' ); 2481 $( '#main-toggle-menu .menu-title' ).addClass( 'closed' ); 2482 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 2483 } 2484 } 2485 self.is_sticky = true; 2486 } 2487 } else { 2488 if ( self.$header.hasClass( 'sticky-header' ) ) { 2489 self.$header.removeClass( 'sticky-header' ); 2490 self.$header.css( 'height', '' ); 2491 self.$menu_wrap.stop().css( 'top', 0 ); 2492 self.$header_main.show(); 2493 2494 var selectric = self.$header.find( '.main-menu-wrap .searchform select' ).data( 'selectric' ); 2495 if ( selectric && typeof selectric.close != 'undefined' ) 2496 selectric.close(); 2497 2498 if ( self.init_toggle_menu ) { 2499 self.init_toggle_menu = false; 2500 theme.MegaMenu.build(); 2501 if ( $( '#main-toggle-menu' ).length ) { 2502 if ( $( '#main-toggle-menu' ).data( 'show-always' ) ) { 2503 $( '#main-toggle-menu' ).addClass( 'show-always' ); 2504 $( '#main-toggle-menu' ).removeClass( 'closed' ); 2505 $( '#main-toggle-menu .menu-title' ).removeClass( 'closed' ); 2506 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 2507 } 2508 } 2509 } 2510 self.is_sticky = false; 2511 } 2512 } 2513 } else { 2514 self.$header_main.show(); 2515 if ( self.$header.parent().hasClass( 'fixed-header' ) && $( '#wpadminbar' ).length && $( '#wpadminbar' ).css( 'position' ) == 'absolute' ) { 2516 // self.$header.parent().css( 'top', ( $( '#wpadminbar' ).height() - scroll_top ) < 0 ? -$( '#wpadminbar' ).height() : -scroll_top ); 2517 } else if ( self.$header.parent().hasClass( 'fixed-header' ) ) { 2518 self.$header.parent().attr( 'style', '' ); 2519 } else { 2520 if ( self.$header.parent().hasClass( 'fixed-header' ) ) 2521 self.$header.parent().attr( 'style', '' ); 2522 } 2523 if ( self.$header.hasClass( 'sticky-menu-header' ) && !theme.isTablet() ) { 2524 self.$header_main.stop().css( 'top', 0 ); 2525 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 2526 self.$header_main.removeClass( 'sticky' ); 2527 self.$header.removeClass( 'sticky-header' ); 2528 self.is_sticky = false; 2529 self.sticky_height = 0; 2530 } else { 2531 if ( self.$menu_wrap ) 2532 self.$menu_wrap.stop().css( 'top', 0 ); 2533 if ( $pageWrapper.hasClass( 'sticky-scroll-up' ) ) { 2534 scroll_top -= self.sticky_height; 2535 if ( scroll_top > self.sticky_pos + 100 ) { 2536 self.$header.addClass( 'sticky-ready' ); 2537 } else { 2538 self.$header.removeClass( 'sticky-ready' ); 2539 } 2540 } 2541 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 ) ) ) ) { 2542 if ( ! self.$header.hasClass( 'sticky-header' ) && ( ! $pageWrapper.hasClass( 'sticky-scroll-up' ) || ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && 'undefined' !== typeof ( $pageWrapper.data( 'prev-scrollpos' ) ) ) ) ) { 2543 var header_height = self.$header.outerHeight(); 2544 self.$header.addClass( 'sticky-header' ).css( 'height', header_height ); 2545 self.$header_main.addClass( 'sticky' ); 2546 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' );
2547 self.$header_main.stop().css( 'top', theme.adminBarHeight() ); 2548 2549 if ( !self.init_toggle_menu ) { 2550 self.init_toggle_menu = true; 2551 theme.MegaMenu.build(); 2552 if ( $( '#main-toggle-menu' ).length ) { 2553 if ( $( '#main-toggle-menu' ).hasClass( 'show-always' ) ) { 2554 $( '#main-toggle-menu' ).data( 'show-always', true ); 2555 $( '#main-toggle-menu' ).removeClass( 'show-always' ); 2556 } 2557 $( '#main-toggle-menu' ).addClass( 'closed' ); 2558 $( '#main-toggle-menu .menu-title' ).addClass( 'closed' ); 2559 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 2560 } 2561 } 2562 self.is_sticky = true; 2563 } 2564 } else { 2565 if ( self.$header.hasClass( 'sticky-header' ) ) { 2566 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 2567 self.$header_main.removeClass( 'sticky' ); 2568 self.$header.removeClass( 'sticky-header' ); 2569 self.$header.css( 'height', '' ); 2570 self.$header_main.stop().css( 'top', 0 ); 2571 2572 if ( self.init_toggle_menu ) { 2573 self.init_toggle_menu = false; 2574 theme.MegaMenu.build(); 2575 if ( $( '#main-toggle-menu' ).length ) { 2576 if ( $( '#main-toggle-menu' ).data( 'show-always' ) ) { 2577 $( '#main-toggle-menu' ).addClass( 'show-always' ); 2578 $( '#main-toggle-menu' ).removeClass( 'closed' ); 2579 $( '#main-toggle-menu .menu-title' ).removeClass( 'closed' ); 2580 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 2581 } 2582 } 2583 } 2584 self.is_sticky = false; 2585 } 2586 } 2587 } 2588 } 2589 2590 if ( !self.$header.hasClass( 'header-loaded' ) ) 2591 self.$header.addClass( 'header-loaded' ); 2592 2593 if ( !self.$header.find( '.logo' ).hasClass( 'logo-transition' ) ) 2594 self.$header.find( '.logo' ).addClass( 'logo-transition' ); 2595 2596 if ( self.$header.find( '.overlay-logo' ).get( 0 ) && !self.$header.find( '.overlay-logo' ).hasClass( 'overlay-logo-transition' ) ) 2597 self.$header.find( '.overlay-logo' ).addClass( 'overlay-logo-transition' ); 2598 2599 return self; 2600 }, 2601 2602 reset: function() { 2603 var self = this; 2604 2605 if ( self.$header.find( '.logo' ).hasClass( 'logo-transition' ) ) 2606 self.$header.find( '.logo' ).removeClass( 'logo-transition' ); 2607 2608 if ( self.$header.find( '.overlay-logo' ).get( 0 ) && self.$header.find( '.overlay-logo' ).hasClass( 'overlay-logo-transition' ) ) 2609 self.$header.find( '.overlay-logo' ).removeClass( 'overlay-logo-transition' ); 2610 2611 if ( self.$menu_wrap && !theme.isTablet() ) { 2612 // show main menu 2613 self.$header.addClass( 'sticky-header sticky-header-calc' ); 2614 self.$header_main.addClass( 'sticky' ); 2615 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' ); 2616 self.sticky_height = self.$menu_wrap.height() + parseInt( self.$menu_wrap.css( 'padding-top' ) ) + parseInt( self.$menu_wrap.css( 'padding-bottom' ) ); 2617 2618 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 2619 self.$header_main.removeClass( 'sticky' ); 2620 self.$header.removeClass( 'sticky-header sticky-header-calc' ); 2621 self.header_height = self.$header.height() + parseInt( self.$header.css( 'margin-top' ) ); 2622 self.menu_height = self.$menu_wrap.height() + parseInt( self.$menu_wrap.css( 'padding-top' ) ) + parseInt( self.$menu_wrap.css( 'padding-bottom' ) ); 2623 2624 self.sticky_pos = ( self.header_height - self.sticky_height ) + parseInt( $( 'body' ).css( 'padding-top' ) ) + parseInt( self.$header.css( 'border-top-width' ) ); 2625 if ( $( '.banner-before-header' ).length ) { 2626 self.sticky_pos += $( '.banner-before-header' ).height(); 2627 } 2628 if ( $( '.porto-block-html-top' ).length ) { 2629 self.sticky_pos += $( '.porto-block-html-top' ).height(); 2630 } 2631 } else { 2632 // show header main 2633 self.$header.addClass( 'sticky-header sticky-header-calc' ); 2634 self.$header_main.addClass( 'sticky' ); 2635 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' ); 2636 self.sticky_height = self.$header_main.outerHeight(); 2637 2638 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 2639 self.$header_main.removeClass( 'sticky' ); 2640 self.$header.removeClass( 'sticky-header sticky-header-calc' ); 2641 self.header_height = self.$header.height() + parseInt( self.$header.css( 'margin-top' ) ); 2642 self.main_height = self.$header_main.height(); 2643 2644 if ( !( !theme.isTablet() || ( theme.isTablet() && !theme.isMobile() && theme.show_sticky_header_tablet ) || ( theme.isMobile() && theme.show_sticky_header_tablet && theme.show_sticky_header_mobile ) ) ) { 2645 self.sticky_height = 0; 2646 } 2647 2648 /*if (self.$header_main.length && self.$header.length) { 2649 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')); 2650 } else { 2651 self.sticky_pos = $('.banner-before-header').height() + parseInt($('body').css('padding-top')) + parseInt(self.$header.css('border-top-width')); 2652 } 2653 if (theme.adminBarHeight() && self.$header.offset().top > theme.adminBarHeight()) { 2654 self.sticky_pos -= theme.adminBarHeight(); 2655 } 2656 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'));*/ 2657 self.sticky_pos = self.$header.offset().top + self.header_height - self.sticky_height - theme.adminBarHeight() + parseInt( self.$header.css( 'border-top-width' ) ); 2658 } 2659 2660 if ( self.reveal ) { 2661 if ( self.menu_height ) { 2662 self.sticky_pos += self.menu_height + 30; 2663 } else { 2664 self.sticky_pos += 30; 2665 } 2666 } 2667 2668 if ( self.sticky_pos < 0 ) { 2669 self.sticky_pos = 0; 2670 } 2671 2672 self.init_toggle_menu = false; 2673 2674 self.$header_main.removeAttr( 'style' ); 2675 if ( !theme.isTablet() && self.$header.hasClass( 'header-side' ) && typeof self.$header.attr( 'data-
2675plugin-sticky' ) != 'undefined' ) { 2676 self.$header.css( 'height', '' ); 2677 } else { 2678 self.$header.removeAttr( 'style' ); 2679 } 2680 return self; 2681 }, 2682 2683 events: function() { 2684 var self = this, win_width = 0; 2685 2686 $( window ).smartresize( function() { 2687 if ( win_width != window.innerWidth ) { 2688 self.reset().build(); 2689 win_width = window.innerWidth; 2690 } 2691 } ); 2692 2693 var scrollEffect = function () { 2694 theme.requestFrame( function() { 2695 self.build(); 2696 var $pageWrapper = $( '.page-wrapper' ); 2697 if ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && ! $( 'html' ).hasClass( 'porto-search-opened' ) ) { 2698 var prevScrollPos = 0, 2699 scrollTop = $( window ).scrollTop(); 2700 if ( $pageWrapper.data( 'prev-scrollpos' ) ) { 2701 prevScrollPos = $pageWrapper.data( 'prev-scrollpos' ); 2702 } 2703 if ( scrollTop >= prevScrollPos ) { 2704 self.$header.addClass( 'scroll-down' ); 2705 } else { 2706 self.$header.removeClass( 'scroll-down' ); 2707 } 2708 $pageWrapper.data( 'prev-scrollpos', scrollTop ); 2709 } 2710 } ); 2711 } 2712 2713 window.addEventListener( 'scroll', scrollEffect, { passive: true } ); 2714 scrollEffect(); 2715 return self; 2716 } 2717 } 2718 2719 } ); 2720 2721} ).apply( this, [window.theme, jQuery] ); 2722 2723// Hash Scroll 2724( function( theme, $ ) { 2725 'use strict'; 2726 2727 theme = theme || {}; 2728 2729 $.extend( theme, { 2730 2731 HashScroll: { 2732 2733 initialize: function() { 2734 2735 this.build() 2736 .events(); 2737 2738 return this; 2739 }, 2740 2741 build: function() { 2742 var self = this; 2743 2744 try { 2745 var hash = window.location.hash; 2746 var target = $( hash ); 2747 if ( target.length && !( hash == '#review_form' || hash == '#reviews' || hash.indexOf( '#comment-' ) != -1 ) ) { 2748 $( 'html, body' ).delay( 600 ).stop().animate( { 2749 scrollTop: target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1 2750 }, 600, 'easeOutQuad' ); 2751 } 2752 2753 return self; 2754 } catch ( err ) { 2755 return self; 2756 } 2757 }, 2758 2759 getTarget: function( href ) { 2760 if ( '#' == href || href.endsWith( '#' ) ) { 2761 return false; 2762 } 2763 var target; 2764 2765 if ( href.indexOf( '#' ) == 0 ) { 2766 target = $( href ); 2767 } else { 2768 var url = window.location.href; 2769 url = url.substring( url.indexOf( '://' ) + 3 ); 2770 if ( url.indexOf( '#' ) != -1 ) 2771 url = url.substring( 0, url.indexOf( '#' ) ); 2772 href = href.substring( href.indexOf( '://' ) + 3 ); 2773 href = href.substring( href.indexOf( url ) + url.length ); 2774 if ( href.indexOf( '#' ) == 0 ) { 2775 target = $( href ); 2776 } 2777 } 2778 return target; 2779 }, 2780 2781 activeMenuItem: function() { 2782 var self = this; 2783 2784 var scroll_pos = $( window ).scrollTop(); 2785 2786 var $menu_items = $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"]' ); 2787 if ( $menu_items.length ) { 2788 $menu_items.each( function() { 2789 var $this = $( this ), 2790 href = $this.attr( 'href' ), 2791 target = self.getTarget( href ); 2792 if ( target && target.get( 0 ) ) { 2793 if ( $this.parent().is( ':last-child' ) && scroll_pos + window.innerHeight >= target.offset().top + target.outerHeight() ) { 2794 $this.parent().siblings().removeClass( 'active' ); 2795 $this.parent().addClass( 'active' ); 2796 } else { 2797 var scroll_to = target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1, 2798 $parent = $this.parent(); 2799 //if (scroll_to <= theme.StickyHeader.sticky_pos + theme.sticky_nav_height) { 2800 //scroll_to = theme.StickyHeader.sticky_pos + theme.sticky_nav_height + 1; 2801 //} 2802 if ( scroll_to <= scroll_pos + 5 ) { 2803 $parent.siblings().removeClass( 'active' ); 2804 $parent.addClass( 'active' ); 2805 if ( $parent.closest( '.secondary-menu' ).length ) { 2806 $parent.closest( '#header' ).find( '.main-menu' ).eq( 0 ).children( '.menu-item.active' ).removeClass( 'active' ); 2807 } 2808 } else { 2809 $parent.removeClass( 'active' ); 2810 } 2811 } 2812 } 2813 } ); 2814 } 2815 2816 return self; 2817 }, 2818 2819 events: function() { 2820 var self = this; 2821 2822 $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"], a[href*="#"].hash-scroll, .hash-scroll-wrap a[href*="#"]' ).on( 'click', function( e ) { 2823 e.preventDefault(); 2824 2825 var $this = $( this ), 2826 href = $this.attr( 'href' ), 2827 target = self.getTarget( href ); 2828 2829 if ( target && target.get( 0 ) ) { 2830 var $parent = $this.parent(); 2831 2832 var scroll_to = target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1; 2833 // if (scroll_to <= theme.StickyHeader.sticky_pos + theme.sticky_nav_height) { 2834 // scroll_to = theme.StickyHeader.sticky_pos + theme.sticky_nav_height + 1; 2835 // } 2836 $( 'html, body' ).stop().animate( { 2837 scrollTop: scroll_to 2838 }, 600, 'easeOutQuad', function() { 2839 //self.activeMenuItem(); 2840 $parent.siblings().removeClass( 'active' ); 2841 $parent.addClass( 'active' ); 2842 } ); 2843 if ( $this.closest( '.porto-popup-menu.opened' ).length ) { 2844 $this.closest( '.porto-popup-menu.opened' ).children( '.hamburguer-btn' ).trigger( 'click' ); 2845 } 2846 } else if ( ( '#' != href || !$this.closest( '.porto-popup-menu.opened' ).length ) && !$this.hasClass( 'nolink' ) ) { 2847 window.location.href = $this.attr( 'href' ); 2848 } 2849 } ); 2850 2851 /*window.addEventListener( 'scroll', function () { 2852 self.activeMenuItem(); 2853 }, { passive: true } );*/ 2854 var $menu_items = $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"]' ); 2855 $menu_items.each( function() {
2856 var rootMargin = '-20% 0px -79.9% 0px', 2857 isLast = $( this ).parent().is( ':last-child' ); 2858 if ( isLast ) { 2859 var obj = document.getElementById( this.hash.replace( '#', '' ) ); 2860 if ( obj && document.body.offsetHeight - obj.offsetTop < window.innerHeight ) { 2861 var ratio = ( window.innerHeight - document.body.offsetHeight + obj.offsetTop ) / window.innerHeight * 0.8; 2862 ratio = Math.round( ratio * 100 ); 2863 rootMargin = '-' + ( 20 + ratio ) + '% 0px -' + ( 79.9 - ratio ) + '% 0px'; 2864 } 2865 } 2866 var callback = function() { 2867 if ( this && typeof this[0] != 'undefined' && this[0].id ) { 2868 $( '.menu-item > a[href*="#' + this[0].id + '"], .porto-sticky-nav .nav > li > a[href*="#' + this[0].id + '"]' ).parent().addClass( 'active' ).siblings().removeClass( 'active' ); 2869 } 2870 }; 2871 self.scrollSpyIntObs( this.hash, callback, { 2872 rootMargin: rootMargin, 2873 thresholds: 0 2874 }, true, isLast, true, $menu_items, $( this ).parent().index() ); 2875 } ); 2876 2877 //self.activeMenuItem(); 2878 2879 return self; 2880 }, 2881 2882 scrollSpyIntObs: function( selector, functionName, intObsOptions, al
2882waysObserve, isLast, firstLoad, $allItems, index ) { 2883 if ( typeof IntersectionObserver == 'undefined' ) { 2884 return this; 2885 } 2886 var obj = document.getElementById( selector.replace( '#', '' ) ); 2887 if ( !obj ) { 2888 return this; 2889 } 2890 2891 var self = this; 2892 2893 var intersectionObserverOptions = { 2894 rootMargin: '0px 0px 200px 0px' 2895 } 2896 2897 if ( Object.keys( intObsOptions ).length ) { 2898 intersectionObserverOptions = $.extend( intersectionObserverOptions, intObsOptions ); 2899 } 2900 2901 var observer = new IntersectionObserver( function( entries ) { 2902 2903 for ( var i = 0; i < entries.length; i++ ) { 2904 var entry = entries[i]; 2905 if ( entry.intersectionRatio > 0 ) { 2906 if ( typeof functionName === 'string' ) { 2907 var func = Function( 'return ' + functionName )(); 2908 } else { 2909 var callback = functionName; 2910 2911 callback.call( $( entry.target ) ); 2912 } 2913 } else { 2914 if ( firstLoad == false ) { 2915 if ( isLast && ! $allItems.closest('.porto-sticky-nav').length ) { 2916 $allItems.filter( '[href*="' + entry.target.id + '"]' ).parent().prev().addClass( 'active' ).siblings().removeClass( 'active' ); 2917 } 2918 } 2919 firstLoad = false; 2920 2921 } 2922 } 2923 }, intersectionObserverOptions ); 2924 2925 observer.observe( obj ); 2926 2927 return this; 2928 } 2929 } 2930 2931 } ); 2932 2933} ).apply( this, [window.theme, jQuery] ); 2934 2935// Float Element 2936( function( theme, $ ) { 2937 2938 'use strict'; 2939 2940 theme = theme || {}; 2941 2942 var instanceName = '__floatElement'; 2943 2944 var PluginFloatElement = function( $el, opts ) { 2945 return this.initialize( $el, opts ); 2946 }; 2947 2948 PluginFloatElement.defaults = { 2949 startPos: 'top', 2950 speed: 3, 2951 horizontal: false, 2952 circle: false, 2953 transition: false, 2954 transitionDelay: 0, 2955 transitionDuration: 500 2956 }; 2957 2958 PluginFloatElement.prototype = { 2959 initialize: function( $el, opts ) { 2960 if ( $el.data( instanceName ) ) { 2961 return this; 2962 } 2963 2964 this.$el = $el; 2965 2966 this 2967 .setData() 2968 .setOptions( opts ) 2969 .build(); 2970 2971 return this; 2972 }, 2973 2974 setData: function() { 2975 this.$el.data( instanceName, this ); 2976 2977 return this; 2978 }, 2979 2980 setOptions: function( opts ) { 2981 this.options = $.extend( true, {}, PluginFloatElement.defaults, opts, { 2982 wrapper: this.$el 2983 } ); 2984 2985 return this; 2986 }, 2987 2988 build: function() { 2989 var self = this, 2990 $el = this.options.wrapper, 2991 $window = $( window ), 2992 minus; 2993 2994 if ( self.options.style ) { 2995 $el.attr( 'style', self.options.style ); 2996 } 2997 2998 if ( self.options.circle ) { 2999 // Set Transition 3000 if ( self.options.transition ) { 3001 $el.css( { 3002 transition: 'ease-out transform ' + self.options.transitionDuration + 'ms ' + self.options.transitionDelay + 'ms' 3003 } ); 3004 } 3005 // Scroll 3006 window.addEventListener( 'scroll', function() { 3007 self.movement( minus ); 3008 }, { passive: true } ); 3009 3010 } else if ( $window.width() > 767 ) { 3011 // Set Start Position 3012 if ( self.options.startPos == 'none' ) { 3013 minus = ''; 3014 } else if ( self.options.startPos == 'top' ) { 3015 $el.css( { 3016 top: 0 3017 } ); 3018 minus = ''; 3019 } else { 3020 $el.css( { 3021 bottom: 0 3022 } ); 3023 minus = '-'; 3024 } 3025 3026 // Set Transition 3027 if ( self.options.transition ) { 3028 $el.css( { 3029 transition: 'ease-out transform ' + self.options.transitionDuration + 'ms ' + self.options.transitionDelay + 'ms' 3030 } ); 3031 } 3032 3033 // First Load 3034 if ( ! self.$el.hasClass( 'marquee' ) ) { 3035 self.movement( minus ); 3036 } 3037 // Scroll 3038 window.addEventListener( 'scroll', function() { 3039 self.movement( minus ); 3040 }, { passive: true } ); 3041 if ( theme.locomotiveScroll ) { 3042 theme.locomotiveScroll.on( 'scroll', function( instance ) { 3043 self.movement( minus, instance.scroll.y ); 3044 } ); 3045 } 3046 } 3047 3048 return this; 3049 }, 3050 3051 movement: function( minus, isLocomotive = false ) { 3052 var self = this, 3053 $el = this.options.wrapper, 3054 $window = $( window ), 3055 scrollTop = isLocomotive === false ? $window.scrollTop() : isLocomotive, 3056 elementOffset = $el.offset().top, 3057 currentElementOffset = ( elementOffset - scrollTop ); 3058 if ( isLocomotive !== false ) { 3059 currentElementOffset = $el.offset().top; 3060 elementOffset = currentElementOffset + scrollTop; 3061 } 3062 if ( self.options.circle ) { 3063 $el.css( { 3064 transform: 'rotate(' + ( scrollTop * 0.25 ) + 'deg)' 3065 } ); 3066 } else { 3067 var scrollPercent = 100 * currentElementOffset / ( $window.height() ); 3068 3069 if ( elementOffset + $el.height() >= scrollTop && elementOffset <= scrollTop + window.innerHeight ) { 3070 3071 if ( !self.options.horizontal ) { 3072 3073 $el.css( { 3074 transform: 'translate3d(0, ' + minus + scrollPercent / self.options.speed + '%, 0)' 3075 } ); 3076 3077 } else { 3078 3079 $el.css( {
3080 transform: 'translate3d(' + minus + scrollPercent / self.options.speed + '%, 0, 0)' 3081 } ); 3082 3083 } 3084 } 3085 } 3086 } 3087 }; 3088 3089 // expose to scope 3090 $.extend( theme, { 3091 PluginFloatElement: PluginFloatElement 3092 } ); 3093 3094 // jquery plugin 3095 $.fn.themePluginFloatElement = function( opts ) { 3096 return this.map( function() { 3097 var $this = $( this ); 3098 3099 if ( $this.data( instanceName ) ) { 3100 return $this.data( instanceName ); 3101 } else { 3102 return new PluginFloatElement( $this, opts ); 3103 } 3104 3105 } ); 3106 } 3107 3108} ).apply( this, [window.theme, jQuery] ); 3109 3110 3111// Init Theme 3112function porto_init( $wrap ) { 3113 'use strict'; 3114 jQuery( window ).on( 'touchstart', function() { } ); 3115 if ( !$wrap ) { 3116 $wrap = jQuery( document.body ); 3117 } 3118 var wrapObj = $wrap.get( 0 ); 3119 $wrap.trigger( 'porto_init_start', [wrapObj] ); 3120 3121 ( function( $ ) { 3122 // Accordion 3123 if ( $.fn.themeAccordion ) { 3124 3125 $( function() { 3126 $wrap.find( '.accordion:not(.manual)' ).each( function() { 3127 var $this = $( this ), 3128 opts; 3129 3130 var pluginOptions = $this.data( 'plugin-options' ); 3131 if ( pluginOptions ) 3132 opts = pluginOptions; 3133 3134 $this.themeAccordion( opts ); 3135 } ); 3136 } ); 3137 } 3138 3139 // Accordion Menu 3140 if ( $.fn.themeAccordionMenu ) { 3141 3142 $( function() { 3143 $wrap.find( '.accordion-menu:not(.manual)' ).each( function() { 3144 var $this = $( this ), 3145 opts; 3146 3147 var pluginOptions = $this.data( 'plugin-options' ); 3148 if ( pluginOptions ) 3149 opts = pluginOptions; 3150 3151 $this.themeAccordionMenu( opts ); 3152 } ); 3153 } ); 3154 3155 } 3156 3157 // Flickr Zoom 3158 if ( $.fn.themeFlickrZoom ) { 3159 3160 $( function() { 3161 $wrap.find( '.wpb_flickr_widget:not(.manual)' ).each( function() { 3162 var $this = $( this ), 3163 opts; 3164 3165 var pluginOptions = $this.data( 'plugin-options' ); 3166 if ( pluginOptions ) 3167 opts = pluginOptions; 3168 3169 $this.themeFlickrZoom( opts ); 3170 } ); 3171 } ); 3172 3173 } 3174 3175 // Lazy Load 3176 if ( $.fn.themePluginLazyLoad ) { 3177 3178 $( function() { 3179 $wrap.find( '[data-plugin-lazyload]:not(.manual)' ).each( function() { 3180 var $this = $( this ), 3181 opts; 3182 3183 var pluginOptions = $this.data( 'plugin-options' ); 3184 if ( pluginOptions ) 3185 opts = pluginOptions; 3186 $this.themePluginLazyLoad( opts ); 3187 } ); 3188 3189 if ( $wrap.find( '.porto-lazyload' ).length ) { 3190 $wrap.find( '.porto-lazyload' ).filter( function() { 3191 if ( $( this ).data( '__lazyload' ) || ( $( this ).closest( '.owl-carousel' ).length && $( this ).closest( '.owl-carousel' ).find( '.owl-item.cloned' ).length ) ) { 3192 return false; 3193 } 3194 return true; 3195 } ).themePluginLazyLoad( { effect: 'fadeIn', effect_speed: 400 } ); 3196 if ( $wrap.find( '.porto-lazyload' ).closest( '.nivoSlider' ).length ) { 3197 theme.requestTimeout( function() { 3198 $wrap.find( '.nivoSlider' ).each( function() { 3199 if ( $( this ).find( '.porto-lazyload' ).length ) { 3200 $( this ).closest( '.nivoSlider' ).find( '.nivo-main-image' ).attr( 'src', $( this ).closest( '.nivoSlider' ).find( '.porto-lazyload' ).eq( 0 ).attr( 'src' ) ); 3201 } 3202 } ); 3203 }, 100 ); 3204 } 3205 if ( $wrap.find( '.porto-lazyload' ).closest( '.porto-carousel-wrapper' ).length ) { 3206 theme.requestTimeout( function() { 3207 $wrap.find( '.porto-carousel-wrapper' ).each( function() { 3208 if ( $( this ).find( '.porto-lazyload:not(.lazy-load-loaded)' ).length ) { 3209 $( this ).find( '.slick-list' ).css( 'height', 'auto' ); 3210 //$( this ).find( '.porto-lazyload:not(.lazy-load-loaded)' ).trigger( 'appear' ); 3211 } 3212 } ); 3213 }, 100 ); 3214 } 3215 } 3216 } ); 3217 3218 } 3219 3220 // Masonry 3221 if ( $.fn.themeMasonry ) { 3222 3223 $( function() { 3224 $wrap.find( '[data-plugin-masonry]:not(.manual)' ).each( function() { 3225 var $this = $( this ), 3226 opts; 3227 if ( $this.hasClass( 'elementor-row' ) ) { 3228 $this.children( '.elementor-column' ).addClass( 'porto-grid-item' ); 3229 } 3230 var pluginOptions = $this.data( 'plugin-options' ); 3231 if ( pluginOptions ) 3232 opts = pluginOptions; 3233 $this.themeMasonry( opts ); 3234 } ); 3235 $wrap.find( '.posts-masonry .posts-container:not(.manual)' ).each( function() { 3236 var pluginOptions = $( this ).data( 'plugin-options' ); 3237 if ( !pluginOptions ) { 3238 pluginOptions = {}; 3239 } 3240 pluginOptions.itemSelector = '.post'; 3241 $( this ).themeMasonry( pluginOptions ); 3242 } ); 3243 $wrap.find( '.page-portfolios .portfolio-row:not(.manual)' ).each( function() { 3244 if ( $( this ).closest( '.porto-grid-container' ).length >
3244 0 || typeof $( this ).attr( 'data-plugin-masonry' ) != 'undefined' ) { 3245 return; 3246 } 3247 var $parent = $( this ).parent(), layoutMode = 'masonry', options, columnWidth = '.portfolio:not(.w2)', timer = null; 3248 3249 if ( $parent.hasClass( 'portfolios-grid' ) ) { 3250 //layoutMode = 'fitRows'; 3251 } else if ( $parent.hasClass( 'portfolios-masonry' ) ) { 3252 if ( !$parent.children( '.bounce-loader' ).length ) { 3253 $parent.append( '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>' ); 3254 } 3255 } 3256 3257 options = { 3258 itemSelector: '.portfolio', 3259 layoutMode: layoutMode, 3260 callback: function() { 3261 timer && clearTimeout( timer ); 3262 timer = setTimeout( function() { 3263 if ( typeof theme.FilterZoom !== 'undefined' ) { 3264 theme.FilterZoom.initialize( $( '.page-portfolios' ) ); 3265 } 3266 $parent.addClass( 'portfolio-iso-active' ); 3267 }, 400 ); 3268 } 3269 }; 3270 if ( layoutMode == 'masonry' ) { 3271 if ( !$parent.find( '.portfolio:not(.w2)' ).length ) 3272 columnWidth = '.portfolio'; 3273 options = $.extend( true, {}, options, { 3274 masonry: { columnWidth: columnWidth } 3275 } ); 3276 } 3277 3278 $( this ).themeMasonry( options ); 3279 3280 } ); 3281 $wrap.find( '.page-members .member-row:not(.manual)' ).each( function() { 3282 $( this ).themeMasonry( { 3283 itemSelector: '.member', 3284 //layoutMode: 'fitRows', 3285 callback: function() { 3286 setTimeout( function() { 3287 if ( typeof theme.FilterZoom !== 'undefined' ) { 3288 theme.FilterZoom.initialize( $( '.page-members' ) ); 3289 } 3290 }, 400 ); 3291 } 3292 } ); 3293 } ); 3294 } ); 3295 3296 } 3297 3298 // Toggle 3299 if ( $.fn.themeToggle ) { 3300 3301 $( function() { 3302 $wrap.find( 'section.toggle:not(.manual)' ).each( function() { 3303 var $this = $( this ), 3304 opts; 3305 3306 var pluginOptions = $this.data( 'plugin-options' ); 3307 if ( pluginOptions ) 3308 opts = pluginOptions; 3309 3310 $this.themeToggle( opts ); 3311 } ); 3312 } ); 3313 3314 } 3315 3316 // Sticky 3317 if ( $.fn.themeSticky ) { 3318 3319 $( function() { 3320 $wrap.find( '[data-plugin-sticky]:not(.manual), .porto-sticky:not(.manual), .porto-sticky-nav:not(.manual)' ).each( function() { 3321 var $this = $( this ), 3322 opts; 3323 3324 var pluginOptions = $this.data( 'plugin-options' ); 3325 if ( pluginOptions ) 3326 opts = pluginOptions; 3327 if ( $this.is( ':visible' ) ) { 3328 $this.themeSticky( opts ); 3329 } 3330 } ); 3331 } ); 3332 } 3333 3334 // Float Element 3335 if ( $.fn['themePluginFloatElement'] ) { 3336 3337 $( function() { 3338 $wrap.find( '[data-plugin-float-element]:not(.manual)' ).each( function() { 3339 var $this = $( this ), 3340 opts; 3341 3342 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 3343 if ( pluginOptions ) 3344 opts = pluginOptions; 3345 3346 $this.themePluginFloatElement( opts ); 3347 } ); 3348 } ); 3349 } 3350 3351 3352 if ( typeof bootstrap != 'undefined' && typeof wrapObj != 'undefined' ) { 3353 // Tooltip 3354 var tooltipTriggerList = [].slice.call( wrapObj.querySelectorAll( "[data-bs-tooltip]:not(.manual), [data-toggle='tooltip']:not(.manual), .star-rating:not(.manual)" ) ); 3355 tooltipTriggerList.map( function( tooltipTriggerEl ) { 3356 return new bootstrap.Tooltip( tooltipTriggerEl ) 3357 } ); 3358 } 3359 // Tabs 3360 $wrap.find( 'a[data-bs-toggle="tab"]' ).off( 'shown.bs.tab' ).on( 'shown.bs.tab', function( e ) { 3361 $( this ).parents( '.nav-tabs' ).find( '.active' ).removeClass( 'active' ); 3362 $( this ).addClass( 'active' ).parent().addClass( 'active' ); 3363 3364 if ( $( this ).closest( '.tabs' ) ) { 3365 var _tabCarousel = $( this ).closest( '.tabs' ).find( '.tab-content>.active' ).find( '.owl-carousel' ); 3366 if ( ! _tabCarousel.data( 'owl.carousel' ) ) { 3367 _tabCarousel.themeCarousel( _tabCarousel.data( 'plugin-options') ); 3368 } 3369 } 3370 3371 } ); 3372 3373 // call async functions 3374 if ( typeof theme.initAsync == 'function' ) { 3375 theme.initAsync( $wrap, wrapObj ); 3376 } else { 3377 $( document.body ).on( 'porto_async_init', function() { 3378 theme.initAsync( $wrap, wrapObj ); 3379 } ); 3380 } 3381 3382 } )( jQuery ); 3383 3384 3385 jQuery( document.body ).trigger( 'porto_init', [$wrap] ); 3386} 3387 3388( function( theme, $ ) { 3389 3390 'use strict'; 3391 3392 $( document ).ready( function() { 3393 // update adminbar height 3394 var win_width = 0; 3395 $( window ).smartresize( function() { 3396 if ( win_width != window.innerWidth ) { 3397 theme.adminBarHeightNum = null; 3398 win_width = window.innerWidth; 3399 } 3400 theme.bodyWidth = document.body.offsetWidth; 3401 } ); 3402 3403 // Scroll to Top 3404 if ( typeof theme.ScrollToTop !== 'undefined' ) { 3405 theme.ScrollToTop.initialize(); 3406 } 3407 setTimeout( function() { 3408 // Init Porto Theme 3409 porto_init(); 3410 }, 0 ); 3411 3412 ( function() { 3413 theme.bodyWidth = theme.bodyWidth || document.body.offsetWidth; 3414 // Mega Menu 3415 if ( typeof theme.MegaMenu !== 'undefined' ) { 3416 theme.MegaMenu.initialize(); 3417 } 3418 } )(); 3419 3420 setTimeout( () => { 3421 // Sticky Header 3422 if ( typeof theme.StickyHeader !== 'undefined' ) { 3423 theme.StickyHeader.initialize(); 3424 } 3425 // Hash Scroll 3426 if ( typeof theme.HashScroll !== 'undefined' ) { 3427 theme.HashScroll.initialize(); 3428 } 3429 } ); 3430 3431 $( document ).trigger( 'porto_theme_init' ); 3432 theme.isReady = true; // isReady after document.ready, isloaded after onload 3433 } ); 3434 $( window ).on( 'load', function() { 3435 // Mobile Sidebar 3436 // filter popup events 3437 $( document ).on( 'click', '.sidebar-toggle', function( e ) { 3438 e.preventDefault(); 3439 var $html = $( 'html' ),
3440 $main = $( '#main' ), 3441 $this = $( this ); 3442 if ( $this.siblings( '.porto-product-filters' ).length ) { 3443 if ( $html.hasClass( 'filter-sidebar-opened' ) ) { 3444 $html.removeClass( 'filter-sidebar-opened' ); 3445 $this.siblings( '.sidebar-overlay' ).removeClass( 'active' ); 3446 if ( $html.hasClass( 'sidebar-right-opened' ) ) { 3447 $html.removeClass( 'sidebar-right-opened' ); 3448 } 3449 } else { 3450 $html.removeClass( 'sidebar-opened' ); 3451 $html.addClass( 'filter-sidebar-opened' ); 3452 $this.siblings( '.sidebar-overlay' ).addClass( 'active' ); 3453 if ( $main.hasClass( 'column2-right-sidebar' ) || $main.hasClass( 'column2-wide-right-sidebar' ) ) { 3454 $html.addClass( 'sidebar-right-opened' ); 3455 } 3456 } 3457 } else { 3458 if ( $html.hasClass( 'sidebar-opened' ) ) { 3459 $html.removeClass( 'sidebar-opened' ); 3460 $( '.sidebar-overlay' ).removeClass( 'active' ); 3461 if ( $html.hasClass( 'sidebar-right-opened' ) ) { 3462 $html.removeClass( 'sidebar-right-opened' ); 3463 } 3464 } else { 3465 $html.addClass( 'sidebar-opened' ); 3466 $( '.sidebar-overlay' ).addClass( 'active' ); 3467 //$( '.mobile-sidebar' ).find( '.porto-lazyload:not(.lazy-load-loaded)' ).trigger( 'appear' ); 3468 if ( $main.hasClass( 'column2-right-sidebar' ) || $main.hasClass( 'column2-wide-right-sidebar' ) ) { 3469 $html.addClass( 'sidebar-right-opened' ); 3470 } 3471 } 3472 } 3473 } ); 3474 3475 $( '#header .mini-cart' ).on( 'click', function( e ) { 3476 let $body = $( 'body' ); 3477 if ( js_porto_vars.cart_url && ( $body.hasClass( 'woocommerce-cart' ) || $body.hasClass( 'woocommerce-checkout' ) ) ) { 3478 location.href = js_porto_vars.cart_url; 3479 } 3480 }); 3481 $( '.minicart-offcanvas .cart-head' ).on( 'click', function() { 3482 let $body = $( 'body' ); 3483 if ( js_porto_vars.cart_url && ( $body.hasClass( 'woocommerce-cart' ) || $body.hasClass( 'woocommerce-checkout' ) ) ) { 3484 return; 3485 } 3486 var $this = $( this ); 3487 $this.closest( '.minicart-offcanvas' ).toggleClass( 'minicart-opened' ); 3488 if ( $this.closest( '.minicart-offcanvas' ).hasClass( 'minicart-opened' ) ) { 3489 $( 'html' ).css( 'margin-right', theme.getScrollbarWidth() ); 3490 $( 'html' ).css( 'overflow', 'hidden' ); 3491 } else { 3492 $( 'html' ).css( 'overflow', '' ); 3493 $( 'html' ).css( 'margin-right', '' ); 3494 } 3495 } ); 3496 3497 $( '.minicart-offcanvas .minicart-overlay' ).on( 'click', function() { 3498 $( this ).closest( '.minicart-offcanvas' ).removeClass( 'minicart-opened' ); 3499 $( 'html' ).css( 'overflow', '' ); 3500 $( 'html' ).css( 'margin-right', '' ); 3501 } ); 3502 3503 $( document.body ).on( 'click', '.sidebar-overlay', function() { 3504 var $html = $( 'html' ); 3505 $html.removeClass( 'sidebar-opened' ); 3506 $html.removeClass( 'filter-sidebar-opened' ); 3507 $( this ).removeClass( 'active' ); 3508 $html.removeClass( 'sidebar-right-opened' ); 3509 } ); 3510 3511 // Section Tab 3512 $( document.body ).on( 'click', '.section-tabs .nav-link', function( e ) { 3513 e.preventDefault(); 3514 var $this = $( this ), 3515 nav_id = $this.data( 'tab' ), 3516 $section_tab = $this.closest( '.section-tabs' ), 3517 $nav_wrap = $section_tab.children( 'ul.nav' ), 3518 $tab_content = $section_tab.children( '.tab-content' ); 3519 if ( nav_id ) { 3520 // Nav Item 3521 $nav_wrap.find( '.active' ).removeClass( 'active' ); 3522 $this.addClass( 'active' ).parent( '.nav-item' ).addClass( 'active' ); 3523 3524 // Content Item 3525 $tab_content.find( '>.active' ).removeClass( 'show active' ); 3526 $tab_content.find( '>.tab-pane[id="' + nav_id + '"]' ).addClass( 'active' ); 3527 let _offsetHeight = $tab_content.find( '>.active' ).get(0).offsetHeight; 3528 $tab_content.find( '>.active' ).addClass( 'show' ); 3529 3530 var _tabCarousel = $tab_content.find( '>.active' ).find( '.owl-carousel' ); 3531 if ( ! _tabCarousel.data( 'owl.carousel' ) ) { 3532 _tabCarousel.themeCarousel( _tabCarousel.data( 'plugin-options') ); 3533 } 3534 } 3535 } ); 3536 3537 $( window ).on( 'resize', function( e ) { 3538 if ( e.originalEvent && window.innerWidth > 991 && $( 'html' ).hasClass( 'sidebar-opened' ) ) { 3539 $( '.sidebar-overlay' ).trigger( 'click' ); 3540 } 3541 } ); 3542 3543 // Match Height 3544 var $matchHeightObj = $( '.tabs-simple .featured-box .box-content, .porto-content-box .featured-box .box-content, .vc_general.vc_cta3, .match-height' ); 3545 if ( $matchHeightObj.length ) { 3546 if ( $.fn.matchHeight ) { 3547 $matchHeightObj.matchHeight(); 3548 } else { 3549 var script = document.createElement( "script" ); 3550 script.addEventListener( "load", function( event ) { 3551 $matchHeightObj.matchHeight(); 3552 } ); 3553 script.src = js_porto_vars.ajax_loader_url.replace( '/images/[email protected]', '/js/libs/jquery.matchHeight.min.js' ); 3554 script.async = true; 3555 document.body.appendChild( script ); 3556 } 3557 } 3558 3559 // WhatsApp Sharing 3560 if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ) ) { 3561 $( '.share-whatsapp' ).css( 'display', 'inline-block' ); 3562 } 3563 $( document ).ajaxComplete( function( event, xhr, options ) { 3564 if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ) ) { 3565 $( '.share-whatsapp' ).css( 'display', 'inline-block' ); 3566 } 3567 } ); 3568 3569 // Add Ege Browser Class 3570 var ua = window.navigator.userAgent, 3571 ie12 = ua.indexOf( 'Edge/' ) > 0;
3572 if ( ie12 ) $( 'html' ).addClass( 'ie12' ); 3573 3574 // Portfolio Link Lightbox 3575 $( document ).on( 'click', '.portfolios-lightbox a.portfolio-link', function( e ) { 3576 $( this ).find( '.thumb-info-zoom' ).trigger( 'click' ); 3577 return false; 3578 } ); 3579 3580 $( '.porto-faqs' ).each( function() { 3581 if ( $( this ).find( '.faq .toggle.active' ).length < 1 ) { 3582 $( this ).find( '.faq' ).eq( 0 ).find( '.toggle' ).addClass( 'active' ); 3583 $( this ).find( '.faq' ).eq( 0 ).find( '.toggle-content' ).show(); 3584 } 3585 } ); 3586 3587 // refresh wpb content 3588 $( document ).on( 'shown.bs.collapse', '.collapse', function() { 3589 var panel = $( this ); 3590 theme.refreshVCContent( panel ); 3591 } ); 3592 $( document ).on( 'shown.bs.tab', 'a[data-bs-toggle="tab"]', function( e ) { 3593 var panel = $( $( e.target ).attr( 'href' ) ); 3594 theme.refreshVCContent( panel ); 3595 } ); 3596 3597 // porto tooltip for header, footer 3598 $( '.porto-tooltip .tooltip-icon' ).on( 'click', function() { 3599 if ( $( this ).parent().children( ".tooltip-popup" ).css( "display" ) == "none" ) { 3600 $( this ).parent().children( ".tooltip-popup" ).fadeIn( 200 ); 3601 } else { 3602 $( this ).parent().children( ".tooltip-popup" ).fadeOut( 200 ); 3603 } 3604 } ); 3605 $( '.porto-tooltip .tooltip-close' ).on( 'click', function() { 3606 $( this ).parent().fadeOut( 200 ); 3607 } ); 3608 3609 // Add Scrollbar width 3610 $( 'body' ).css( '--porto-scroll-w', theme.getScrollbarWidth() + 'px' ); 3611 } ); 3612 3613} ).apply( this, [window.theme, jQuery] ); 3614 3615( function( theme, $, undefined ) { 3616 "use strict"; 3617 3618 $( document ).ready( function() { 3619 $( window ).on( 'vc_reload', function() { 3620 porto_init(); 3621 $( '.type-post' ).addClass( 'post' ); 3622 $( '.type-portfolio' ).addClass( 'portfolio' ); 3623 $( '.type-member' ).addClass( 'member' ); 3624 $( '.type-block' ).addClass( 'block' ); 3625 } ); 3626 } ); 3627 3628 /* 3629 * Experience Timeline 3630 */ 3631 var timelineHeightAdjust = { 3632 $timeline: $( '#exp-timeline' ), 3633 $timelineBar: $( '#exp-timeline .timeline-bar' ), 3634 $firstTimelineItem: $( '#exp-timeline .timeline-box' ).first(), 3635 $lastTimelineItem: $( '#exp-timeline .timeline-box' ).last(), 3636 3637 build: function() { 3638 var self = this; 3639 3640 self.adjustHeight(); 3641 }, 3642 adjustHeight: function() { 3643 var self = this, 3644 calcFirstItemHeight = ( self.$firstTimelineItem.outerHeight( true ) / 2 ) + 5, 3645 calcLastItemHeight = ( self.$lastTimelineItem.outerHeight( true ) / 2 ) + 5; 3646 3647 // Set Timeline Bar Top and Bottom 3648 self.$timelineBar.css( { 3649 top: calcFirstItemHeight, 3650 bottom: calcLastItemHeight 3651 } ); 3652 } 3653 } 3654 3655 if ( $( '#exp-timeline' ).get( 0 ) ) { 3656 // Adjust Timeline Height On Resize 3657 var timeline_timer = null; 3658 $( window ).smartresize( function() { 3659 if ( timeline_timer ) { 3660 clearTimeout( timeline_timer ); 3661 } 3662 timeline_timer = setTimeout( function() { 3663 timelineHeightAdjust.build(); 3664 }, 800 ); 3665 } ); 3666 3667 timelineHeightAdjust.build(); 3668 } 3669 3670 $( '.custom-view-our-location' ).on( 'click', function( e ) { 3671 e.preventDefault(); 3672 var this_ = $( this ); 3673 $( '.custom-googlemap' ).slideDown( '1000', function() { 3674 this_.delay( 700 ).hide(); 3675 } ); 3676 } ); 3677 3678 // compatibility with w3 total cache 3679 window.addEventListener( 3680 'LazyLoad::Initialized', 3681 function ( event ) { 3682 theme.w3tcLazyLoadInstance = event.detail.instance; 3683 }, 3684 false 3685 ); 3686 3687} )( window.theme, jQuery ); 3688 3689// Porto 4.0 extra shortcodes 3690( function( theme, $, undefined ) { 3691 'use strict'; 3692 3693 window.addEventListener( 'load', function() { 3694 theme.isLoaded = true; 3695 } ); 3696 3697 $( document ).ready( function() { 3698 if ( typeof elementorFrontend != 'undefined' ) { 3699 // fix Elementor ScrollTop 3700 $( window ).on( 'elementor/frontend/init', function() { 3701 elementorFrontend.hooks.addFilter( 'frontend/handlers/menu_anchor/scroll_top_distance', function( scrollTop ) { 3702 if ( theme && theme.StickyHeader && typeof theme.sticky_nav_height != 'undefined' ) { 3703 if ( elementorFrontend.elements.$wpAdminBar.length ) { 3704 scrollTop += elementorFrontend.elements.$wpAdminBar.height(); 3705 } 3706 scrollTop = scrollTop - theme.adminBarHeight() - theme.StickyHeader.sticky_height - theme.sticky_nav_height + 1; 3707 } 3708 return scrollTop; 3709 } ); 3710 elementorFrontend.elements.$window.on( 'elementor/nested-tabs/activate', function( e, content ) { 3711 var _tabCarousel = $( content ).find( '.owl-carousel' ); 3712 if ( ! _tabCarousel.data( 'owl.carousel' ) ) { 3713 _tabCarousel.themeCarousel( _tabCarousel.data( 'plugin-options' ) ); 3714 } 3715 }); 3716 } ); 3717 } 3718 } ); 3719 3720 // widget wysija 3721 $( '#footer .widget_wysija .wysija-submit:not(.btn)' ).addClass( 'btn btn-default' ); 3722 3723 // fixed visual compoer issue which has owl carousel 3724 if ( $( '[data-vc-parallax] .owl-carousel' ).length ) { 3725 theme.requestTimeout( function() { if ( typeof window.vcParallaxSkroll == 'object' ) { window.vcParallaxSkroll.refresh(); } }, 200 ); 3726 } 3727 3728 if ( $( '.page-content > .alignfull, .post-content > .alignfull' ).length ) { 3729 var initAlignFull = function() { 3730 $( '.page-content > .alignfull, .post-content > .alignfull' ).each( function() { 3731 $( 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 ) ) ); 3732 } ); 3733 };
3734 initAlignFull(); 3735 $( window ).smartresize( function() { 3736 initAlignFull(); 3737 } ); 3738 } 3739} )( 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.