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