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 };
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 ( ! $menuWrap.length && ! $headerContainer.length ) { 1995 $headerContainer = $( menu ).closest( '.container, .container-fluid' ); 1996 } 1997 1998 if ( $headerContainer.length >= 1 ) { 1999 var isParent = false; 2000 $headerContainer.each( function () { 2001 var $this = $(this); 2002 if ( $this.find( menu ).length && ! isParent ) { 2003 $headerContainer = $this; 2004 isParent = true; 2005 } 2006 } ); 2007 if ( ! isParent ) { 2008 $headerContainer = $menuWrap; 2009 } 2010 } 2011 if ( ! $headerContainer.length ) { 2012 return; 2013 } 2014 2015 var menuContainerWidth = $headerContainer.outerWidth() - parseInt( $headerContainer.css( 'padding-left' ) ) - parseInt( $headerContainer.css( 'padding-right' ) ) - ctSpacing; 2016 if ( menuContainerWidth < 900 ) return; 2017 if ( menu.parent().hasClass( 'pos-fullwidth' ) ) { 2018 menu.get( 0 ).style.width = menuContainerWidth + 'px'; 2019 } 2020 var browserWidth = document.body.offsetWidth, 2021 menuLeftPos = menu.offset().left - ( ( browserWidth - menuContainerWidth ) / 2 ), 2022 l = false; 2023 2024 if ( 'center' == is_left ) { 2025 var remainWidth = menuContainerWidth - ( menuLeftPos + menu.width() ); 2026 if ( remainWidth <= 0 ) { 2027 l = remainWidth; 2028 } else if ( menuLeftPos <= 0 ) { 2029 l = -menuLeftPos; 2030 } 2031 } else if ( 'justify' == is_left ) { 2032 if ( window.theme.rtl ) { 2033 menuLeftPos = browserWidth - ( menu.offset().left + menu.outerWidth() ) - ( browserWidth - menuContainerWidth ) / 2; 2034 } 2035 var menuWidth = menu.width(), 2036 remainWidth = menuContainerWidth - ( menuLeftPos + menuWidth ); 2037 if ( menuLeftPos > remainWidth && menuLeftPos < menuWidth ) { 2038 l = ( menuLeftPos + remainWidth ) / 3; 2039 } 2040 if ( remainWidth <= 0 ) { 2041 l = -remainWidth; 2042 } 2043 } else if ( false !== is_left ) { 2044 var remainWidth = menuContainerWidth - ( menuLeftPos + menu.width() ); 2045 if ( remainWidth <= 0 ) { 2046 l = -remainWidth; 2047 } 2048 } else if ( menuLeftPos <= 0 ) { 2049 l = -menuLeftPos; 2050 } 2051 return l; 2052 }, 2053 2054 build: function( $menu ) { 2055 var self = this; 2056 if ( !$menu ) { 2057 $menu = self.$menu; 2058 } 2059 2060 $menu.each( function() { 2061 var $menu = $( this ), 2062 $menu_container = $menu.closest( '.container' ), 2063 container_width = self.popupWidth(); 2064 if ( $menu.closest( '.porto-popup-menu' ).length ) { 2065 return false; 2066 } 2067 2068 var $menu_items = $menu.children( 'li.has-sub' ); 2069 2070 $menu_items.each( function() { 2071 var $menu_item = $( this ), 2072 $popup = $menu_item.children( '.popup' ); 2073 if ( $popup.length ) { 2074 var popup_obj = $popup.get( 0 ); 2075 popup_obj.style.display = 'block'; 2076 if ( $menu_item.hasClass( 'wide' ) ) { 2077 popup_obj.style.left = 0; 2078 var padding = parseInt( $popup.css( 'padding-left' ) ) + parseInt( $popup.css( 'padding-right' ) ) + 2079 parseInt( $popup.find( '> .inner' ).css( 'padding-left' ) ) + parseInt( $popup.find( '> .inner' ).css( 'padding-right' ) ); 2080 2081 var row_number = 4; 2082 2083 if ( $menu_item.hasClass( 'col-1' ) ) row_number = 1; 2084 if ( $menu_item.hasClass( 'col-2' ) ) row_number = 2; 2085 if ( $menu_item.hasClass( 'col-3' ) ) row_number = 3; 2086 if ( $menu_item.hasClass( 'col-4' ) ) row_number = 4; 2087 if ( $menu_item.hasClass( 'col-5' ) ) row_number = 5; 2088 if ( $menu_item.hasClass( 'col-6' ) ) row_number = 6; 2089 2090 if ( window.innerWidth < 992 ) 2091 row_number = 1; 2092 2093 var col_length = 0; 2094 $popup.find( '> .inner > ul > li' ).each( function() { 2095 var cols = parseFloat( $( this ).attr( 'data-cols' ) ); 2096 if ( cols <= 0 || !cols ) 2097 cols = 1; 2098 2099 if ( cols > row_number ) 2100 cols = row_number; 2101 2102 col_length += cols; 2103 } ); 2104 2105 if ( col_length > row_number ) col_length = row_number; 2106 2107 var popup_max_width = $popup.data( 'popup-mw' ) ? $popup.data( 'popup-mw' ) : $popup.find( '.inner' ).css( 'max-width' ), 2108 col_width = container_width / row_number; 2109 if ( 'none' !== popup_max_width && parseInt( popup_max_width ) < container_width ) { 2110 col_width = parseInt( popup_max_width ) / row_number; 2111 } 2112 2113 $popup.find( '> .inner > ul > li' ).each( function() { 2114 var cols = parseFloat( $( this ).data( 'cols' ) ); 2115 if ( cols <= 0 ) 2116 cols = 1; 2117 2118 if ( cols > row_number ) 2119 cols = row_number; 2120 2121 if ( $menu_item.hasClass( 'pos-center' ) || $menu_item.hasClass( 'pos-left' ) || $menu_item.hasClass( 'pos-right' ) ) 2122 this.style.width = ( 100 / col_length * cols ) + '%'; 2123 else 2124 this.style.width = ( 100 / row_number * cols ) + '%'; 2125 } ); 2126 2127 if ( $menu_item.hasClass( 'pos-center' ) ) { // position center 2128 var width = col_width * col_length - padding; 2129 $popup.find( '> .inner > ul' ).get( 0 ).style.width = width + 'px'; 2130 var left_position = ( $menu_item.outerWidth() - width ) / 2; 2131 popup_obj.style.left = left_position + 'px'; 2132 popup_obj.style.right = 'auto'; 2133 self.SetMenuPosition( popup_obj, $popup, 'center', left_position ); 2134 } else if ( $menu_item.hasClass( 'pos-left' ) ) { // position left 2135 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( col_width * col_length - padding ) + 'px'; 2136 popup_obj.style.left = '0'; 2137 popup_obj.style.right = 'auto'; 2138 self.SetMenuPosition( popup_obj, $popup ); 2139 } else if ( $menu_item.hasClass( 'pos-right' ) ) { // position right 2140 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( col_width * col_length - padding ) + 'px'; 2141 popup_obj.style.right = '0'; 2142 popup_obj.style.left = 'auto'; 2143 self.SetMenuPosition( popup_obj, $popup, false ); 2144 } else if ( $menu_item.hasClass( 'pos-fullwidth' ) ) { 2145 popup_obj.style.right = 'auto'; 2146 popup_obj.style.left = '0'; 2147 self.SetMenuPosition( popup_obj, $popup ); 2148 } else { 2149 $popup.find( '> .inner > ul' ).get( 0 ).style.width = ( container_width - padding ) + 'px'; 2150 if ( theme.rtl ) { 2151 popup_obj.style.right = '0'; 2152 popup_obj.style.left = 'auto'; 2153 } else { 2154 popup_obj.style.left = '0'; 2155 popup_obj.style.right = 'auto'; 2156 } 2157 self.SetMenuPosition( popup_obj, $popup, 'justify' ); 2158 } 2159 } else { // auto position 2160 if ( $menu_item.hasClass( 'pos-left' ) ) { // position left 2161 if ( $popup.offset().left + $popup.width() > window.innerWidth ) { 2162 $menu_item.removeClass( 'pos-left' ).addClass( 'pos-right' ); 2163 } 2164 } else if ( $menu_item.hasClass( 'pos-right' ) ) { // position right 2165 if ( $popup.offset().left < 0 ) { 2166 $menu_item.removeClass( 'pos-right' ).addClass( 'pos-left' ); 2167 } 2168 } else { // position justify 2169 if ( $popup.offset().left + $popup.width() > window.innerWidth ) { 2170 $menu_item.addClass( 'pos-right' ); 2171 } else if ( $popup.find( '> .inner > ul' ).length ) { 2172 var $sub_menu = $popup.find( '> .inner > ul' ).eq( 0 ); 2173 if ( $sub_menu.offset().left + $sub_menu.width() + 200 > window.innerWidth ) { 2174 $sub_menu.addClass( 'pos-left' ); 2175 } 2176 } 2177 } 2178 } 2179 $menu_item.addClass( 'sub-ready' ); 2180 } 2181 } ); 2182 } ); 2183 2184 return self; 2185 }, 2186 2187 SetMenuPosition: function ( popup_obj, $popup, is_left = true, offsetWidth = 0 ) { 2188 setTimeout( () => { 2189 var self = this, 2190 left_position = self.calcMenuPosition( $popup, is_left ); 2191 if ( 0 !== left_position ) { 2192 if ( 'center' == is_left ) { 2193 // Center 2194 if ( false !== left_position ) { 2195 popup_obj.style.left = ( offsetWidth + left_position ) + 'px'; 2196 popup_obj.style.right = 'auto'; 2197 } 2198 } else if ( 'justify' == is_left ) { 2199 if ( theme.rtl ) { 2200 popup_obj.style.left = 'auto'; 2201 if ( left_position ) { 2202 popup_obj.style.right = '-' + left_position + 'px'; 2203 } else { 2204 if ( ! $( 'body' ).hasClass( 'wide' ) ) { 2205 popup_obj.style.right = '-15px'; 2206 } else { 2207 popup_obj.style.right = '0'; 2208 } 2209 } 2210 } else { 2211 popup_obj.style.right = 'auto'; 2212 if ( left_position ) { 2213 popup_obj.style.left = '-' + left_position + 'px'; 2214 } else { 2215 if ( ! $( 'body' ).hasClass( 'wide' ) ) { 2216 popup_obj.style.left = '-15px'; 2217 } else { 2218 popup_obj.style.left = '0'; 2219 } 2220 } 2221 } 2222 } else { 2223 if ( is_left ) { 2224 popup_obj.style.right = 'auto'; 2225 if ( false !== left_position ) { 2226 popup_obj.style.left = '-' + left_position + 'px'; 2227 } else { 2228
2228 if ( ! $( 'body' ).hasClass( 'wide' ) ) { 2229 popup_obj.style.left = '-15px'; 2230 } else { 2231 popup_obj.style.left = '0'; 2232 } 2233 } 2234 } else { 2235 popup_obj.style.left = 'auto'; 2236 if ( false !== left_position ) { 2237 popup_obj.style.right = '-' + left_position + 'px'; 2238 } else { 2239 if ( ! $( 'body' ).hasClass( 'wide' ) ) { 2240 popup_obj.style.right = '-15px'; 2241 } else { 2242 popup_obj.style.right = '0'; 2243 } 2244 } 2245 } 2246 } 2247 } 2248 $popup.parent().addClass( 'loaded' ); 2249 } ); 2250 }, 2251 2252 events: function() { 2253 var self = this; 2254 2255 $( window ).smartresize( function( e ) { 2256 if ( e.originalEvent ) { 2257 self.build(); 2258 } 2259 } ); 2260 2261 if ( theme.isLoaded ) { 2262 theme.requestFrame( function() { 2263 self.build(); 2264 } ); 2265 } else { 2266 $( window ).on( 'load', function() { 2267 theme.requestFrame( function() { 2268 self.build(); 2269 } ); 2270 } ); 2271 } 2272 2273 if ( self.$menu.length ) { 2274 self.$menu.on( 'mouseenter', '.menu-item.has-sub', function( e ) { 2275 var $thePopup = $( e.currentTarget ).find( '>.popup' ); 2276 if ( $thePopup.find( '.owl-carousel:not(.owl-loaded)' ).length == 0 ) { 2277 return; 2278 } 2279 $thePopup.find( '.owl-carousel:not(.owl-loaded)' ).each( function() { 2280 var $this = $( this ), 2281 opts; 2282 if ( ! $this.hasClass( 'owl-loaded' ) ) { 2283 var pluginOptions = $this.data( 'plugin-options' ); 2284 if ( pluginOptions ) 2285 opts = pluginOptions; 2286 if ( $.fn.themeCarousel ) { 2287 $this.themeCarousel( opts ); 2288 } 2289 } 2290 }); 2291 }); 2292 } 2293 return self; 2294 } 2295 } 2296 2297 } ); 2298 2299} ).apply( this, [window.theme, jQuery] ); 2300 2301 2302// Sticky Header 2303( function( theme, $ ) { 2304 'use strict'; 2305 2306 theme = theme || {}; 2307 2308 $.extend( theme, { 2309 2310 StickyHeader: { 2311 2312 defaults: { 2313 header: $( '#header' ) 2314 }, 2315 2316 initialize: function( $header ) { 2317 this.$header = ( $header || this.defaults.header ); 2318 this.sticky_height = 0; 2319 this.sticky_pos = 0; 2320 this.change_logo = theme.change_logo; 2321 2322 if ( !theme.show_sticky_header || !this.$header.length || $( '.side-header-narrow-bar' ).length ) 2323 return this; 2324 2325 var self = this; 2326 2327 var $menu_wrap = self.$header.find( '> .main-menu-wrap' ); 2328 if ( $menu_wrap.length ) { 2329 self.$menu_wrap = $menu_wrap; 2330 self.menu_height = $menu_wrap.height(); 2331 } else { 2332 self.$menu_wrap = false; 2333 } 2334 2335 self.$header_main = self.$header.find( '.header-main' ); 2336 2337 if ( self.$header_main.length > 1 ) { 2338 self.$header_main = $( self.$header_main[0] ); 2339 } 2340 2341 // fix compatibility issue with Elementor pro header builder 2342 if ( !self.$header_main.length && self.$header.children( '.elementor-location-header' ).length ) { 2343 self.$header_main = self.$header.children( '.elementor-location-header' ).last().addClass( 'header-main' ); 2344 } 2345 2346 if ( !self.$header_main.length ) { 2347 return this; 2348 } 2349 2350 self.reveal = self.$header.parents( '.header-wrapper' ).hasClass( 'header-reveal' ); 2351 2352 self.is_sticky = false; 2353 2354 self.reset() 2355 .build() 2356 .events(); 2357 2358 return self; 2359 }, 2360 2361 build: function() { 2362 var self = this; 2363 2364 if ( !self.is_sticky && ( window.innerHeight + self.header_height + theme.adminBarHeight() + parseInt( self.$header.css( 'border-top-width' ) ) >= $( document ).height() ) ) { 2365 return self; 2366 } 2367 2368 if ( window.innerHeight > $( document.body ).height() ) 2369 window.scrollTo( 0, 0 ); 2370 2371 var scroll_top = $( window ).scrollTop(), 2372 $pageWrapper = $( '.page-wrapper' ); 2373 2374 if ( self.$menu_wrap && !theme.isTablet() ) { 2375 2376 self.$header_main.stop().css( 'top', 0 ); 2377 2378 if ( self.$header.parent().hasClass( 'fixed-header' ) ) 2379 self.$header.parent().attr( 'style', '' ); 2380 2381 // Scroll Up - Header Type 2382 if ( $( '.page-wrapper' ).hasClass( 'sticky-scroll-up' ) ) { 2383 scroll_top -= self.sticky_height; 2384 if ( scroll_top > self.sticky_pos + 100 ) { 2385 self.$header.addClass( 'sticky-ready' ); 2386 } else { 2387 self.$header.removeClass( 'sticky-ready' ); 2388 } 2389 } 2390 if ( scroll_top > self.sticky_pos ) { 2391 if ( !self.$header.hasClass( 'sticky-header' ) && ( ! $pageWrapper.hasClass( 'sticky-scroll-up' ) || ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && 'undefined' !== typeof ( $pageWrapper.data( 'prev-scrollpos' ) ) ) ) ) { 2392 var header_height = self.$header.outerHeight(); 2393 self.$header.addClass( 'sticky-header' ).css( 'height', header_height );
2394 self.$menu_wrap.stop().css( 'top', theme.adminBarHeight() ); 2395 2396 var selectric = self.$header.find( '.header-main .searchform select' ).data( 'selectric' ); 2397 if ( selectric && typeof selectric.close != 'undefined' ) 2398 selectric.close(); 2399 2400 if ( self.$header.parent().hasClass( 'fixed-header' ) ) { 2401 self.$header_main.hide(); 2402 self.$header.css( 'height', '' ); 2403 } 2404 2405 if ( !self.init_toggle_menu ) { 2406 self.init_toggle_menu = true; 2407 theme.MegaMenu.build(); 2408 if ( $( '#main-toggle-menu' ).length ) { 2409 if ( $( '#main-toggle-menu' ).hasClass( 'show-always' ) ) { 2410 $( '#main-toggle-menu' ).data( 'show-always', true ); 2411 $( '#main-toggle-menu' ).removeClass( 'show-always' ); 2412 } 2413 $( '#main-toggle-menu' ).addClass( 'closed' ); 2414 $( '#main-toggle-menu .menu-title' ).addClass( 'closed' ); 2415 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 2416 } 2417 } 2418 self.is_sticky = true; 2419 } 2420 } else { 2421 if ( self.$header.hasClass( 'sticky-header' ) ) { 2422 self.$header.removeClass( 'sticky-header' ); 2423 self.$header.css( 'height', '' ); 2424 self.$menu_wrap.stop().css( 'top', 0 ); 2425 self.$header_main.show(); 2426 2427 var selectric = self.$header.find( '.main-menu-wrap .searchform select' ).data( 'selectric' ); 2428 if ( selectric && typeof selectric.close != 'undefined' ) 2429 selectric.close(); 2430 2431 if ( self.init_toggle_menu ) { 2432 self.init_toggle_menu = false; 2433 theme.MegaMenu.build(); 2434 if ( $( '#main-toggle-menu' ).length ) { 2435 if ( $( '#main-toggle-menu' ).data( 'show-always' ) ) { 2436 $( '#main-toggle-menu' ).addClass( 'show-always' ); 2437 $( '#main-toggle-menu' ).removeClass( 'closed' ); 2438 $( '#main-toggle-menu .menu-title' ).removeClass( 'closed' ); 2439 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 2440 } 2441 } 2442 } 2443 self.is_sticky = false; 2444 } 2445 } 2446 } else { 2447 self.$header_main.show(); 2448 if ( self.$header.parent().hasClass( 'fixed-header' ) && $( '#wpadminbar' ).length && $( '#wpadminbar' ).css( 'position' ) == 'absolute' ) { 2449 // self.$header.parent().css( 'top', ( $( '#wpadminbar' ).height() - scroll_top ) < 0 ? -$( '#wpadminbar' ).height() : -scroll_top ); 2450 } else if ( self.$header.parent().hasClass( 'fixed-header' ) ) { 2451 self.$header.parent().attr( 'style', '' ); 2452 } else { 2453 if ( self.$header.parent().hasClass( 'fixed-header' ) ) 2454 self.$header.parent().attr( 'style', '' ); 2455 } 2456 if ( self.$header.hasClass( 'sticky-menu-header' ) && !theme.isTablet() ) { 2457 self.$header_main.stop().css( 'top', 0 ); 2458 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 2459 self.$header_main.removeClass( 'sticky' ); 2460 self.$header.removeClass( 'sticky-header' ); 2461 self.is_sticky = false; 2462 self.sticky_height = 0; 2463 } else { 2464 if ( self.$menu_wrap ) 2465 self.$menu_wrap.stop().css( 'top', 0 ); 2466 if ( $pageWrapper.hasClass( 'sticky-scroll-up' ) ) { 2467 scroll_top -= self.sticky_height; 2468 if ( scroll_top > self.sticky_pos + 100 ) { 2469 self.$header.addClass( 'sticky-ready' ); 2470 } else { 2471 self.$header.removeClass( 'sticky-ready' ); 2472 } 2473 } 2474 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 ) ) ) ) { 2475 if ( ! self.$header.hasClass( 'sticky-header' ) && ( ! $pageWrapper.hasClass( 'sticky-scroll-up' ) || ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && 'undefined' !== typeof ( $pageWrapper.data( 'prev-scrollpos' ) ) ) ) ) { 2476 var header_height = self.$header.outerHeight(); 2477 self.$header.addClass( 'sticky-header' ).css( 'height', header_height ); 2478 self.$header_main.addClass( 'sticky' ); 2479 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' );
2480 self.$header_main.stop().css( 'top', theme.adminBarHeight() ); 2481 2482 if ( !self.init_toggle_menu ) { 2483 self.init_toggle_menu = true; 2484 theme.MegaMenu.build(); 2485 if ( $( '#main-toggle-menu' ).length ) { 2486 if ( $( '#main-toggle-menu' ).hasClass( 'show-always' ) ) { 2487 $( '#main-toggle-menu' ).data( 'show-always', true ); 2488 $( '#main-toggle-menu' ).removeClass( 'show-always' ); 2489 } 2490 $( '#main-toggle-menu' ).addClass( 'closed' ); 2491 $( '#main-toggle-menu .menu-title' ).addClass( 'closed' ); 2492 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 2493 } 2494 } 2495 self.is_sticky = true; 2496 } 2497 } else { 2498 if ( self.$header.hasClass( 'sticky-header' ) ) { 2499 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 2500 self.$header_main.removeClass( 'sticky' ); 2501 self.$header.removeClass( 'sticky-header' ); 2502 self.$header.css( 'height', '' ); 2503 self.$header_main.stop().css( 'top', 0 ); 2504 2505 if ( self.init_toggle_menu ) { 2506 self.init_toggle_menu = false; 2507 theme.MegaMenu.build(); 2508 if ( $( '#main-toggle-menu' ).length ) { 2509 if ( $( '#main-toggle-menu' ).data( 'show-always' ) ) { 2510 $( '#main-toggle-menu' ).addClass( 'show-always' ); 2511 $( '#main-toggle-menu' ).removeClass( 'closed' ); 2512 $( '#main-toggle-menu .menu-title' ).removeClass( 'closed' ); 2513 $( '#main-toggle-menu .toggle-menu-wrap' ).attr( 'style', '' ); 2514 } 2515 } 2516 } 2517 self.is_sticky = false; 2518 } 2519 } 2520 } 2521 } 2522 2523 if ( !self.$header.hasClass( 'header-loaded' ) ) 2524 self.$header.addClass( 'header-loaded' ); 2525 2526 if ( !self.$header.find( '.logo' ).hasClass( 'logo-transition' ) ) 2527 self.$header.find( '.logo' ).addClass( 'logo-transition' ); 2528 2529 if ( self.$header.find( '.overlay-logo' ).get( 0 ) && !self.$header.find( '.overlay-logo' ).hasClass( 'overlay-logo-transition' ) ) 2530 self.$header.find( '.overlay-logo' ).addClass( 'overlay-logo-transition' ); 2531 2532 return self; 2533 }, 2534 2535 reset: function() { 2536 var self = this; 2537 2538 if ( self.$header.find( '.logo' ).hasClass( 'logo-transition' ) ) 2539 self.$header.find( '.logo' ).removeClass( 'logo-transition' ); 2540 2541 if ( self.$header.find( '.overlay-logo' ).get( 0 ) && self.$header.find( '.overlay-logo' ).hasClass( 'overlay-logo-transition' ) ) 2542 self.$header.find( '.overlay-logo' ).removeClass( 'overlay-logo-transition' ); 2543 2544 if ( self.$menu_wrap && !theme.isTablet() ) { 2545 // show main menu 2546 self.$header.addClass( 'sticky-header sticky-header-calc' ); 2547 self.$header_main.addClass( 'sticky' ); 2548 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' ); 2549 self.sticky_height = self.$menu_wrap.height() + parseInt( self.$menu_wrap.css( 'padding-top' ) ) + parseInt( self.$menu_wrap.css( 'padding-bottom' ) ); 2550 2551 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 2552 self.$header_main.removeClass( 'sticky' ); 2553 self.$header.removeClass( 'sticky-header sticky-header-calc' ); 2554 self.header_height = self.$header.height() + parseInt( self.$header.css( 'margin-top' ) ); 2555 self.menu_height = self.$menu_wrap.height() + parseInt( self.$menu_wrap.css( 'padding-top' ) ) + parseInt( self.$menu_wrap.css( 'padding-bottom' ) ); 2556 2557 self.sticky_pos = ( self.header_height - self.sticky_height ) + parseInt( $( 'body' ).css( 'padding-top' ) ) + parseInt( self.$header.css( 'border-top-width' ) ); 2558 if ( $( '.banner-before-header' ).length ) { 2559 self.sticky_pos += $( '.banner-before-header' ).height(); 2560 } 2561 if ( $( '.porto-block-html-top' ).length ) { 2562 self.sticky_pos += $( '.porto-block-html-top' ).height(); 2563 } 2564 } else { 2565 // show header main 2566 self.$header.addClass( 'sticky-header sticky-header-calc' ); 2567 self.$header_main.addClass( 'sticky' ); 2568 if ( self.change_logo ) self.$header_main.addClass( 'change-logo' ); 2569 self.sticky_height = self.$header_main.outerHeight(); 2570 2571 if ( self.change_logo ) self.$header_main.removeClass( 'change-logo' ); 2572 self.$header_main.removeClass( 'sticky' ); 2573 self.$header.removeClass( 'sticky-header sticky-header-calc' ); 2574 self.header_height = self.$header.height() + parseInt( self.$header.css( 'margin-top' ) ); 2575 self.main_height = self.$header_main.height(); 2576 2577 if ( !( !theme.isTablet() || ( theme.isTablet() && !theme.isMobile() && theme.show_sticky_header_tablet ) || ( theme.isMobile() && theme.show_sticky_header_tablet && theme.show_sticky_header_mobile ) ) ) { 2578 self.sticky_height = 0; 2579 } 2580 2581 /*if (self.$header_main.length && self.$header.length) { 2582 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')); 2583 } else { 2584 self.sticky_pos = $('.banner-before-header').height() + parseInt($('body').css('padding-top')) + parseInt(self.$header.css('border-top-width')); 2585 } 2586 if (theme.adminBarHeight() && self.$header.offset().top > theme.adminBarHeight()) { 2587 self.sticky_pos -= theme.adminBarHeight(); 2588 } 2589 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'));*/ 2590 self.sticky_pos = self.$header.offset().top + self.header_height - self.sticky_height - theme.adminBarHeight() + parseInt( self.$header.css( 'border-top-width' ) ); 2591 } 2592 2593 if ( self.reveal ) { 2594 if ( self.menu_height ) { 2595 self.sticky_pos += self.menu_height + 30; 2596 } else { 2597 self.sticky_pos += 30; 2598 } 2599 } 2600 2601 if ( self.sticky_pos < 0 ) { 2602 self.sticky_pos = 0; 2603 } 2604 2605 self.init_toggle_menu = false; 2606 2607 self.$header_main.removeAttr( 'style' ); 2608 if ( !theme.isTablet() && self.$header.hasClass( 'header-side' ) && typeof self.$header.attr( 'data-
2608plugin-sticky' ) != 'undefined' ) { 2609 self.$header.css( 'height', '' ); 2610 } else { 2611 self.$header.removeAttr( 'style' ); 2612 } 2613 return self; 2614 }, 2615 2616 events: function() { 2617 var self = this, win_width = 0; 2618 2619 $( window ).smartresize( function() { 2620 if ( win_width != window.innerWidth ) { 2621 self.reset().build(); 2622 win_width = window.innerWidth; 2623 } 2624 } ); 2625 2626 var scrollEffect = function () { 2627 theme.requestFrame( function() { 2628 self.build(); 2629 var $pageWrapper = $( '.page-wrapper' ); 2630 if ( $pageWrapper.hasClass( 'sticky-scroll-up' ) && ! $( 'html' ).hasClass( 'porto-search-opened' ) ) { 2631 var prevScrollPos = 0, 2632 scrollTop = $( window ).scrollTop(); 2633 if ( $pageWrapper.data( 'prev-scrollpos' ) ) { 2634 prevScrollPos = $pageWrapper.data( 'prev-scrollpos' ); 2635 } 2636 if ( scrollTop > prevScrollPos ) { 2637 self.$header.addClass( 'scroll-down' ); 2638 } else { 2639 self.$header.removeClass( 'scroll-down' ); 2640 } 2641 $pageWrapper.data( 'prev-scrollpos', scrollTop ); 2642 } 2643 } ); 2644 } 2645 2646 window.addEventListener( 'scroll', scrollEffect, { passive: true } ); 2647 scrollEffect(); 2648 return self; 2649 } 2650 } 2651 2652 } ); 2653 2654} ).apply( this, [window.theme, jQuery] ); 2655 2656// Hash Scroll 2657( function( theme, $ ) { 2658 'use strict'; 2659 2660 theme = theme || {}; 2661 2662 $.extend( theme, { 2663 2664 HashScroll: { 2665 2666 initialize: function() { 2667 2668 this.build() 2669 .events(); 2670 2671 return this; 2672 }, 2673 2674 build: function() { 2675 var self = this; 2676 2677 try { 2678 var hash = window.location.hash; 2679 var target = $( hash ); 2680 if ( target.length && !( hash == '#review_form' || hash == '#reviews' || hash.indexOf( '#comment-' ) != -1 ) ) { 2681 $( 'html, body' ).delay( 600 ).stop().animate( { 2682 scrollTop: target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1 2683 }, 600, 'easeOutQuad' ); 2684 } 2685 2686 return self; 2687 } catch ( err ) { 2688 return self; 2689 } 2690 }, 2691 2692 getTarget: function( href ) { 2693 if ( '#' == href || href.endsWith( '#' ) ) { 2694 return false; 2695 } 2696 var target; 2697 2698 if ( href.indexOf( '#' ) == 0 ) { 2699 target = $( href ); 2700 } else { 2701 var url = window.location.href; 2702 url = url.substring( url.indexOf( '://' ) + 3 ); 2703 if ( url.indexOf( '#' ) != -1 ) 2704 url = url.substring( 0, url.indexOf( '#' ) ); 2705 href = href.substring( href.indexOf( '://' ) + 3 ); 2706 href = href.substring( href.indexOf( url ) + url.length ); 2707 if ( href.indexOf( '#' ) == 0 ) { 2708 target = $( href ); 2709 } 2710 } 2711 return target; 2712 }, 2713 2714 activeMenuItem: function() { 2715 var self = this; 2716 2717 var scroll_pos = $( window ).scrollTop(); 2718 2719 var $menu_items = $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"]' ); 2720 if ( $menu_items.length ) { 2721 $menu_items.each( function() { 2722 var $this = $( this ), 2723 href = $this.attr( 'href' ), 2724 target = self.getTarget( href ); 2725 if ( target && target.get( 0 ) ) { 2726 if ( $this.parent().is( ':last-child' ) && scroll_pos + window.innerHeight >= target.offset().top + target.outerHeight() ) { 2727 $this.parent().siblings().removeClass( 'active' ); 2728 $this.parent().addClass( 'active' ); 2729 } else { 2730 var scroll_to = target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1, 2731 $parent = $this.parent(); 2732 //if (scroll_to <= theme.StickyHeader.sticky_pos + theme.sticky_nav_height) { 2733 //scroll_to = theme.StickyHeader.sticky_pos + theme.sticky_nav_height + 1; 2734 //} 2735 if ( scroll_to <= scroll_pos + 5 ) { 2736 $parent.siblings().removeClass( 'active' ); 2737 $parent.addClass( 'active' ); 2738 if ( $parent.closest( '.secondary-menu' ).length ) { 2739 $parent.closest( '#header' ).find( '.main-menu' ).eq( 0 ).children( '.menu-item.active' ).removeClass( 'active' ); 2740 } 2741 } else { 2742 $parent.removeClass( 'active' ); 2743 } 2744 } 2745 } 2746 } ); 2747 } 2748 2749 return self; 2750 }, 2751 2752 events: function() { 2753 var self = this; 2754 2755 $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"], a[href*="#"].hash-scroll, .hash-scroll-wrap a[href*="#"]' ).on( 'click', function( e ) { 2756 e.preventDefault(); 2757 2758 var $this = $( this ), 2759 href = $this.attr( 'href' ), 2760 target = self.getTarget( href ); 2761 2762 if ( target && target.get( 0 ) ) { 2763 var $parent = $this.parent(); 2764 2765 var scroll_to = target.offset().top - theme.StickyHeader.sticky_height - theme.adminBarHeight() - theme.sticky_nav_height + 1; 2766 // if (scroll_to <= theme.StickyHeader.sticky_pos + theme.sticky_nav_height) { 2767 // scroll_to = theme.StickyHeader.sticky_pos + theme.sticky_nav_height + 1; 2768 // } 2769 $( 'html, body' ).stop().animate( { 2770 scrollTop: scroll_to 2771 }, 600, 'easeOutQuad', function() { 2772 //self.activeMenuItem(); 2773 $parent.siblings().removeClass( 'active' ); 2774 $parent.addClass( 'active' ); 2775 } ); 2776 if ( $this.closest( '.porto-popup-menu.opened' ).length ) { 2777 $this.closest( '.porto-popup-menu.opened' ).children( '.hamburguer-btn' ).trigger( 'click' ); 2778 } 2779 } else if ( ( '#' != href || !$this.closest( '.porto-popup-menu.opened' ).length ) && !$this.hasClass( 'nolink' ) ) { 2780 window.location.href = $this.attr( 'href' ); 2781 } 2782 } ); 2783 2784 /*window.addEventListener( 'scroll', function () { 2785 self.activeMenuItem(); 2786 }, { passive: true } );*/ 2787 var $menu_items = $( '.menu-item > a[href*="#"], .porto-sticky-nav .nav > li > a[href*="#"]' ); 2788 $menu_items.each( function() {
2789 var rootMargin = '-20% 0px -79.9% 0px', 2790 isLast = $( this ).parent().is( ':last-child' ); 2791 if ( isLast ) { 2792 var obj = document.getElementById( this.hash.replace( '#', '' ) ); 2793 if ( obj && document.body.offsetHeight - obj.offsetTop < window.innerHeight ) { 2794 var ratio = ( window.innerHeight - document.body.offsetHeight + obj.offsetTop ) / window.innerHeight * 0.8; 2795 ratio = Math.round( ratio * 100 ); 2796 rootMargin = '-' + ( 20 + ratio ) + '% 0px -' + ( 79.9 - ratio ) + '% 0px'; 2797 } 2798 } 2799 var callback = function() { 2800 if ( this && typeof this[0] != 'undefined' && this[0].id ) { 2801 $( '.menu-item > a[href*="#' + this[0].id + '"], .porto-sticky-nav .nav > li > a[href*="#' + this[0].id + '"]' ).parent().addClass( 'active' ).siblings().removeClass( 'active' ); 2802 } 2803 }; 2804 self.scrollSpyIntObs( this.hash, callback, { 2805 rootMargin: rootMargin, 2806 thresholds: 0 2807 }, true, isLast, true, $menu_items, $( this ).parent().index() ); 2808 } ); 2809 2810 //self.activeMenuItem(); 2811 2812 return self; 2813 }, 2814 2815 scrollSpyIntObs: function( selector, functionName, intObsOptions, al
2815waysObserve, isLast, firstLoad, $allItems, index ) { 2816 if ( typeof IntersectionObserver == 'undefined' ) { 2817 return this; 2818 } 2819 var obj = document.getElementById( selector.replace( '#', '' ) ); 2820 if ( !obj ) { 2821 return this; 2822 } 2823 2824 var self = this; 2825 2826 var intersectionObserverOptions = { 2827 rootMargin: '0px 0px 200px 0px' 2828 } 2829 2830 if ( Object.keys( intObsOptions ).length ) { 2831 intersectionObserverOptions = $.extend( intersectionObserverOptions, intObsOptions ); 2832 } 2833 2834 var observer = new IntersectionObserver( function( entries ) { 2835 2836 for ( var i = 0; i < entries.length; i++ ) { 2837 var entry = entries[i]; 2838 if ( entry.intersectionRatio > 0 ) { 2839 if ( typeof functionName === 'string' ) { 2840 var func = Function( 'return ' + functionName )(); 2841 } else { 2842 var callback = functionName; 2843 2844 callback.call( $( entry.target ) ); 2845 } 2846 } else { 2847 if ( firstLoad == false ) { 2848 if ( isLast && ! $allItems.closest('.porto-sticky-nav').length ) { 2849 $allItems.filter( '[href*="' + entry.target.id + '"]' ).parent().prev().addClass( 'active' ).siblings().removeClass( 'active' ); 2850 } 2851 } 2852 firstLoad = false; 2853 2854 } 2855 } 2856 }, intersectionObserverOptions ); 2857 2858 observer.observe( obj ); 2859 2860 return this; 2861 } 2862 } 2863 2864 } ); 2865 2866} ).apply( this, [window.theme, jQuery] ); 2867 2868 2869// Init Theme 2870function porto_init( $wrap = '', initial = false ) { 2871 jQuery( window ).on( 'touchstart', function() { } ); 2872 if ( !$wrap ) { 2873 $wrap = jQuery( document.body ); 2874 } 2875 var wrapObj = $wrap.get( 0 ); 2876 $wrap.trigger( 'porto_init_start', [wrapObj] ); 2877 2878 ( function( $ ) { 2879 // Accordion 2880 if ( $.fn.themeAccordion ) { 2881 2882 $( function() { 2883 $wrap.find( '.accordion:not(.manual)' ).each( function() { 2884 var $this = $( this ), 2885 opts; 2886 2887 var pluginOptions = $this.data( 'plugin-options' ); 2888 if ( pluginOptions ) 2889 opts = pluginOptions; 2890 2891 $this.themeAccordion( opts ); 2892 } ); 2893 } ); 2894 } 2895 2896 // Accordion Menu 2897 if ( $.fn.themeAccordionMenu ) { 2898 2899 $( function() { 2900 $wrap.find( '.accordion-menu:not(.manual)' ).each( function() { 2901 var $this = $( this ), 2902 opts; 2903 2904 var pluginOptions = $this.data( 'plugin-options' ); 2905 if ( pluginOptions ) 2906 opts = pluginOptions; 2907 2908 $this.themeAccordionMenu( opts ); 2909 } ); 2910 } ); 2911 2912 } 2913 2914 // Flickr Zoom 2915 if ( $.fn.themeFlickrZoom ) { 2916 2917 $( function() { 2918 $wrap.find( '.wpb_flickr_widget:not(.manual)' ).each( function() { 2919 var $this = $( this ), 2920 opts; 2921 2922 var pluginOptions = $this.data( 'plugin-options' ); 2923 if ( pluginOptions ) 2924 opts = pluginOptions; 2925 2926 $this.themeFlickrZoom( opts ); 2927 } ); 2928 } ); 2929 2930 } 2931 2932 // Masonry 2933 if ( $.fn.themeMasonry ) { 2934 2935 $( function() { 2936 $wrap.find( '[data-plugin-masonry]:not(.manual)' ).each( function() { 2937 var $this = $( this ), 2938 opts; 2939 if ( $this.hasClass( 'elementor-row' ) ) { 2940 $this.children( '.elementor-column' ).addClass( 'porto-grid-item' ); 2941 } 2942 var pluginOptions = $this.data( 'plugin-options' ); 2943 if ( pluginOptions ) 2944 opts = pluginOptions; 2945 $this.themeMasonry( opts ); 2946 } ); 2947 $wrap.find( '.posts-masonry .posts-container:not(.manual)' ).each( function() { 2948 var pluginOptions = $( this ).data( 'plugin-options' ); 2949 if ( !pluginOptions ) { 2950 pluginOptions = {}; 2951 } 2952 pluginOptions.itemSelector = '.post'; 2953 $( this ).themeMasonry( pluginOptions ); 2954 } ); 2955 $wrap.find( '.page-portfolios .portfolio-row:not(.manual)' ).each( function() { 2956 if ( $( this ).closest( '.porto-grid-container' ).length > 0 || typeof $( this ).attr( 'data-plugin-masonry' ) != 'undefined' ) { 2957 return; 2958 } 2959 var $parent = $( this ).parent(), layoutMode = 'masonry', options, columnWidth = '.portfolio:not(.w2)', timer = null; 2960 2961 if ( $parent.hasClass( 'portfolios-grid' ) ) { 2962 //layoutMode = 'fitRows'; 2963 } else if ( $parent.hasClass( 'portfolios-masonry' ) ) { 2964 if ( !$parent.children( '.bounce-loader' ).length ) { 2965 $parent.append( '<div class="bounce-loader"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>' ); 2966 } 2967 } 2968 2969 options = { 2970 itemSelector: '.portfolio', 2971 layoutMode: layoutMode,
2972 callback: function() { 2973 timer && clearTimeout( timer ); 2974 timer = setTimeout( function() { 2975 if ( typeof theme.FilterZoom !== 'undefined' ) { 2976 theme.FilterZoom.initialize( $( '.page-portfolios' ) ); 2977 } 2978 $parent.addClass( 'portfolio-iso-active' ); 2979 }, 400 ); 2980 } 2981 }; 2982 if ( layoutMode == 'masonry' ) { 2983 if ( !$parent.find( '.portfolio:not(.w2)' ).length ) 2984 columnWidth = '.portfolio'; 2985 options = $.extend( true, {}, options, { 2986 masonry: { columnWidth: columnWidth } 2987 } ); 2988 } 2989 2990 $( this ).themeMasonry( options ); 2991 2992 } ); 2993 $wrap.find( '.page-members .member-row:not(.manual)' ).each( function() { 2994 $( this ).themeMasonry( { 2995 itemSelector: '.member', 2996 //layoutMode: 'fitRows', 2997 callback: function() { 2998 setTimeout( function() { 2999 if ( typeof theme.FilterZoom !== 'undefined' ) { 3000 theme.FilterZoom.initialize( $( '.page-members' ) ); 3001 } 3002 }, 400 ); 3003 } 3004 } ); 3005 } ); 3006 } ); 3007 3008 } 3009 3010 // Toggle 3011 if ( $.fn.themeToggle ) { 3012 3013 $( function() { 3014 $wrap.find( 'section.toggle:not(.manual)' ).each( function() { 3015 var $this = $( this ), 3016 opts; 3017 3018 var pluginOptions = $this.data( 'plugin-options' ); 3019 if ( pluginOptions ) 3020 opts = pluginOptions; 3021 3022 $this.themeToggle( opts ); 3023 } ); 3024 } ); 3025 3026 } 3027 3028 // Sticky 3029 if ( $.fn.themeSticky ) { 3030 3031 $( function() { 3032 $wrap.find( '[data-plugin-sticky]:not(.manual), .porto-sticky:not(.manual), .porto-sticky-nav:not(.manual)' ).each( function() { 3033 var $this = $( this ), 3034 opts; 3035 3036 var pluginOptions = $this.data( 'plugin-options' ); 3037 if ( pluginOptions ) 3038 opts = pluginOptions; 3039 if ( $this.is( ':visible' ) ) { 3040 $this.themeSticky( opts ); 3041 } 3042 } ); 3043 } ); 3044 } 3045 3046 if ( typeof bootstrap != 'undefined' && typeof wrapObj != 'undefined' ) { 3047 // Tooltip 3048 var tooltipTriggerList = [].slice.call( wrapObj.querySelectorAll( "[data-bs-tooltip]:not(.manual), [data-toggle='tooltip']:not(.manual), .star-rating:not(.manual)" ) ); 3049 tooltipTriggerList.map( function( tooltipTriggerEl ) { 3050 return new bootstrap.Tooltip( tooltipTriggerEl ) 3051 } ); 3052 } 3053 // Tabs 3054 $wrap.find( 'a[data-bs-toggle="tab"]' ).off( 'shown.bs.tab' ).on( 'shown.bs.tab', function( e ) { 3055 let $this = $( this ); 3056 if ( $this.closest( '.custom-nav-sidebar' ).length ) { // For hotel demo 3057 return; 3058 } 3059 $this.parents( '.nav-tabs' ).find( '.active' ).removeClass( 'active' ); 3060 $this.addClass( 'active' ).parent().addClass( 'active' ); 3061 3062 if ( $this.closest( '.tabs' ) ) { 3063 var _tabCarousel = $this.closest( '.tabs' ).find( '.tab-content>.active' ).find( '.owl-carousel' ); 3064 if ( ! _tabCarousel.data( 'owl.carousel' ) ) { 3065 _tabCarousel.themeCarousel( _tabCarousel.data( 'plugin-options') ); 3066 } 3067 } 3068 3069 } ); 3070 3071 // call async functions 3072 if ( typeof theme.initAsync == 'function' ) { 3073 theme.initAsync( $wrap, wrapObj ); 3074 } else { 3075 $( document.body ).on( 'porto_async_init', function() { 3076 theme.initAsync( $wrap, wrapObj ); 3077 } ); 3078 } 3079 3080 } )( jQuery ); 3081 3082 3083 jQuery( document.body ).trigger( 'porto_init', [$wrap, initial] ); 3084} 3085 3086( function( theme, $ ) { 3087 3088 'use strict'; 3089 3090 $( document ).ready( function() { 3091 // update adminbar height 3092 var win_width = 0; 3093 $( window ).smartresize( function() { 3094 if ( win_width != window.innerWidth ) { 3095 theme.adminBarHeightNum = null; 3096 win_width = window.innerWidth; 3097 } 3098 theme.bodyWidth = document.body.offsetWidth; 3099 } ); 3100 3101 // Scroll to Top 3102 if ( typeof theme.ScrollToTop !== 'undefined' ) { 3103 theme.ScrollToTop.initialize(); 3104 } 3105 setTimeout( function() { 3106 // Sticky Header 3107 if ( typeof theme.StickyHeader !== 'undefined' ) { 3108 theme.StickyHeader.initialize(); 3109 } 3110 // Init Porto Theme 3111 porto_init( $( document.body ), true ); 3112 }, 0 ); 3113 3114 ( function() { 3115 theme.bodyWidth = theme.bodyWidth || document.body.offsetWidth; 3116 // Mega Menu 3117 if ( typeof theme.MegaMenu !== 'undefined' ) { 3118 theme.MegaMenu.initialize(); 3119 } 3120 } )(); 3121 3122 setTimeout( () => { 3123 3124 // Hash Scroll 3125 if ( typeof theme.HashScroll !== 'undefined' ) { 3126 theme.HashScroll.initialize(); 3127 } 3128 } ); 3129 3130 $( document ).trigger( 'porto_theme_init' ); 3131 theme.isReady = true; // isReady after document.ready, isloaded after onload 3132 } ); 3133 $( window ).on( 'load', function() { 3134 // Mobile Sidebar 3135 // filter popup events 3136 $( document ).on( 'click', '.sidebar-toggle', function( e ) { 3137 e.preventDefault(); 3138 var $html = $( 'html' ),
3139 $main = $( '#main' ), 3140 $this = $( this ); 3141 if ( $this.siblings( '.porto-product-filters' ).length ) { 3142 if ( $html.hasClass( 'filter-sidebar-opened' ) ) { 3143 $html.removeClass( 'filter-sidebar-opened' ); 3144 $this.siblings( '.sidebar-overlay' ).removeClass( 'active' ); 3145 if ( $html.hasClass( 'sidebar-right-opened' ) ) { 3146 $html.removeClass( 'sidebar-right-opened' ); 3147 } 3148 } else { 3149 $html.removeClass( 'sidebar-opened' ); 3150 $html.addClass( 'filter-sidebar-opened' ); 3151 $this.siblings( '.sidebar-overlay' ).addClass( 'active' ); 3152 if ( $main.hasClass( 'column2-right-sidebar' ) || $main.hasClass( 'column2-wide-right-sidebar' ) ) { 3153 $html.addClass( 'sidebar-right-opened' ); 3154 } 3155 } 3156 } else { 3157 if ( $html.hasClass( 'sidebar-opened' ) ) { 3158 $html.removeClass( 'sidebar-opened' ); 3159 $( '.sidebar-overlay' ).removeClass( 'active' ); 3160 if ( $html.hasClass( 'sidebar-right-opened' ) ) { 3161 $html.removeClass( 'sidebar-right-opened' ); 3162 } 3163 } else { 3164 $html.addClass( 'sidebar-opened' ); 3165 $( '.sidebar-overlay' ).addClass( 'active' ); 3166 //$( '.mobile-sidebar' ).find( '.porto-lazyload:not(.lazy-load-loaded)' ).trigger( 'appear' ); 3167 if ( $main.hasClass( 'column2-right-sidebar' ) || $main.hasClass( 'column2-wide-right-sidebar' ) ) { 3168 $html.addClass( 'sidebar-right-opened' ); 3169 } 3170 } 3171 } 3172 } ); 3173 3174 $( '#header .mini-cart' ).on( 'click', function( e ) { 3175 let $body = $( 'body' ); 3176 if ( js_porto_vars.cart_url && ( $body.hasClass( 'woocommerce-cart' ) || $body.hasClass( 'woocommerce-checkout' ) ) ) { 3177 location.href = js_porto_vars.cart_url; 3178 } 3179 }); 3180 $( '.minicart-offcanvas .cart-head' ).on( 'click', function() { 3181 let $body = $( 'body' ); 3182 if ( js_porto_vars.cart_url && ( $body.hasClass( 'woocommerce-cart' ) || $body.hasClass( 'woocommerce-checkout' ) ) ) { 3183 return; 3184 } 3185 var $this = $( this ); 3186 $this.closest( '.minicart-offcanvas' ).toggleClass( 'minicart-opened' ); 3187 if ( $this.closest( '.minicart-offcanvas' ).hasClass( 'minicart-opened' ) ) { 3188 $( 'html' ).css( 'margin-right', theme.getScrollbarWidth() ); 3189 $( 'html' ).css( 'overflow', 'hidden' ); 3190 } else { 3191 $( 'html' ).css( 'overflow', '' ); 3192 $( 'html' ).css( 'margin-right', '' ); 3193 } 3194 } ); 3195 3196 $( '.minicart-offcanvas .minicart-overlay' ).on( 'click', function() { 3197 $( this ).closest( '.minicart-offcanvas' ).removeClass( 'minicart-opened' ); 3198 $( '.d-none .minicart-offcanvas.minicart-opened' ).removeClass( 'minicart-opened' ); 3199 $( 'html' ).css( 'overflow', '' ); 3200 $( 'html' ).css( 'margin-right', '' ); 3201 } ); 3202 3203 $( document.body ).on( 'click', '.sidebar-overlay', function() { 3204 var $html = $( 'html' ); 3205 $html.removeClass( 'sidebar-opened' ); 3206 $html.removeClass( 'filter-sidebar-opened' ); 3207 $( this ).removeClass( 'active' ); 3208 $html.removeClass( 'sidebar-right-opened' ); 3209 } ); 3210 3211 // Section Tab 3212 $( document.body ).on( 'click', '.section-tabs .nav-link', function( e ) { 3213 e.preventDefault(); 3214 var $this = $( this ), 3215 nav_id = $this.data( 'tab' ), 3216 $section_tab = $this.closest( '.section-tabs' ), 3217 $nav_wrap = $section_tab.children( 'ul.nav' ), 3218 $tab_content = $section_tab.children( '.tab-content' ); 3219 if ( nav_id ) { 3220 // Nav Item 3221 $nav_wrap.find( '.active' ).removeClass( 'active' ); 3222 $this.addClass( 'active' ).parent( '.nav-item' ).addClass( 'active' ); 3223 3224 // Content Item 3225 $tab_content.find( '>.active' ).removeClass( 'show active' ); 3226 $tab_content.find( '>.tab-pane[id="' + nav_id + '"]' ).addClass( 'active' ); 3227 let _offsetHeight = $tab_content.find( '>.active' ).get(0).offsetHeight; 3228 $tab_content.find( '>.active' ).addClass( 'show' ); 3229 3230 var _tabCarousel = $tab_content.find( '>.active' ).find( '.owl-carousel' ); 3231 if ( ! _tabCarousel.data( 'owl.carousel' ) ) { 3232 _tabCarousel.themeCarousel( _tabCarousel.data( 'plugin-options') ); 3233 } 3234 } 3235 } ); 3236 3237 $( window ).on( 'resize', function( e ) { 3238 if ( e.originalEvent && window.innerWidth > 991 && $( 'html' ).hasClass( 'sidebar-opened' ) ) { 3239 $( '.sidebar-overlay' ).trigger( 'click' ); 3240 } 3241 } ); 3242 3243 // Match Height 3244 var $matchHeightObj = $( '.tabs-simple .featured-box .box-content, .porto-content-box .featured-box .box-content, .vc_general.vc_cta3, .match-height' ); 3245 if ( $matchHeightObj.length ) { 3246 if ( $.fn.matchHeight ) { 3247 $matchHeightObj.matchHeight(); 3248 } else { 3249 var script = document.createElement( "script" ); 3250 script.addEventListener( "load", function( event ) { 3251 $matchHeightObj.matchHeight(); 3252 } ); 3253 script.src = js_porto_vars.ajax_loader_url.replace( '/images/[email protected]', '/js/libs/jquery.matchHeight.min.js' ); 3254 script.async = true; 3255 document.body.appendChild( script ); 3256 } 3257 } 3258 3259 // WhatsApp Sharing 3260 /*if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ) ) { 3261 $( '.share-whatsapp' ).css( 'display', 'inline-block' ); 3262 } 3263 $( document ).ajaxComplete( function( event, xhr, options ) { 3264 if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ) ) { 3265 $( '.share-whatsapp' ).css( 'display', 'inline-block' ); 3266 } 3267 } );*/ 3268 3269 // Add Ege Browser Class 3270 var ua = window.navigator.userAgent, 3271 ie12 = ua.indexOf( 'Edge/' ) > 0;
3272 if ( ie12 ) $( 'html' ).addClass( 'ie12' ); 3273 3274 // Portfolio Link Lightbox 3275 $( document ).on( 'click', '.portfolios-lightbox a.portfolio-link', function( e ) { 3276 $( this ).find( '.thumb-info-zoom' ).trigger( 'click' ); 3277 return false; 3278 } ); 3279 3280 $( '.porto-faqs' ).each( function() { 3281 if ( $( this ).find( '.faq .toggle.active' ).length < 1 ) { 3282 $( this ).find( '.faq' ).eq( 0 ).find( '.toggle' ).addClass( 'active' ); 3283 $( this ).find( '.faq' ).eq( 0 ).find( '.toggle-content' ).show(); 3284 } 3285 } ); 3286 3287 // refresh wpb content 3288 $( document ).on( 'shown.bs.collapse', '.collapse', function() { 3289 var panel = $( this ); 3290 theme.refreshVCContent( panel ); 3291 } ); 3292 $( document ).on( 'shown.bs.tab', 'a[data-bs-toggle="tab"]', function( e ) { 3293 var panel = $( $( e.target ).attr( 'href' ) ); 3294 theme.refreshVCContent( panel ); 3295 } ); 3296 3297 // porto tooltip for header, footer 3298 $( '.porto-tooltip .tooltip-icon' ).on( 'click', function() { 3299 if ( $( this ).parent().children( ".tooltip-popup" ).css( "display" ) == "none" ) { 3300 $( this ).parent().children( ".tooltip-popup" ).fadeIn( 200 ); 3301 } else { 3302 $( this ).parent().children( ".tooltip-popup" ).fadeOut( 200 ); 3303 } 3304 } ); 3305 $( '.porto-tooltip .tooltip-close' ).on( 'click', function() { 3306 $( this ).parent().fadeOut( 200 ); 3307 } ); 3308 3309 // Add Scrollbar width 3310 $( 'body' ).css( '--porto-scroll-w', theme.getScrollbarWidth() + 'px' ); 3311 } ); 3312 3313} ).apply( this, [window.theme, jQuery] ); 3314 3315( function( theme, $, undefined ) { 3316 "use strict"; 3317 3318 $( document ).ready( function() { 3319 $( window ).on( 'vc_reload', function() { 3320 porto_init(); 3321 $( '.type-post' ).addClass( 'post' ); 3322 $( '.type-portfolio' ).addClass( 'portfolio' ); 3323 $( '.type-member' ).addClass( 'member' ); 3324 $( '.type-block' ).addClass( 'block' ); 3325 } ); 3326 } ); 3327 3328 /* 3329 * Experience Timeline 3330 */ 3331 var timelineHeightAdjust = { 3332 $timeline: $( '#exp-timeline' ), 3333 $timelineBar: $( '#exp-timeline .timeline-bar' ), 3334 $firstTimelineItem: $( '#exp-timeline .timeline-box' ).first(), 3335 $lastTimelineItem: $( '#exp-timeline .timeline-box' ).last(), 3336 3337 build: function() { 3338 var self = this; 3339 3340 self.adjustHeight(); 3341 }, 3342 adjustHeight: function() { 3343 var self = this, 3344 calcFirstItemHeight = ( self.$firstTimelineItem.outerHeight( true ) / 2 ) + 5, 3345 calcLastItemHeight = ( self.$lastTimelineItem.outerHeight( true ) / 2 ) + 5; 3346 3347 // Set Timeline Bar Top and Bottom 3348 self.$timelineBar.css( { 3349 top: calcFirstItemHeight, 3350 bottom: calcLastItemHeight 3351 } ); 3352 } 3353 } 3354 3355 if ( $( '#exp-timeline' ).get( 0 ) ) { 3356 // Adjust Timeline Height On Resize 3357 var timeline_timer = null; 3358 $( window ).smartresize( function() { 3359 if ( timeline_timer ) { 3360 clearTimeout( timeline_timer ); 3361 } 3362 timeline_timer = setTimeout( function() { 3363 timelineHeightAdjust.build(); 3364 }, 800 ); 3365 } ); 3366 3367 timelineHeightAdjust.build(); 3368 } 3369 3370 $( '.custom-view-our-location' ).on( 'click', function( e ) { 3371 e.preventDefault(); 3372 var this_ = $( this ); 3373 $( '.custom-googlemap' ).slideDown( '1000', function() { 3374 this_.delay( 700 ).hide(); 3375 } ); 3376 } ); 3377 3378 // compatibility with w3 total cache 3379 window.addEventListener( 3380 'LazyLoad::Initialized', 3381 function ( event ) { 3382 theme.w3tcLazyLoadInstance = event.detail.instance; 3383 }, 3384 false 3385 ); 3386 3387} )( window.theme, jQuery ); 3388 3389// Porto 4.0 extra shortcodes 3390( function( theme, $, undefined ) { 3391 'use strict'; 3392 3393 window.addEventListener( 'load', function() { 3394 theme.isLoaded = true; 3395 } ); 3396 3397 // fix Elementor ScrollTop 3398 $( window ).on( 'elementor/frontend/init', function() { 3399 if ( typeof elementorFrontend != 'undefined' ) { 3400 elementorFrontend.hooks.addFilter( 'frontend/handlers/menu_anchor/scroll_top_distance', function( scrollTop ) { 3401 if ( theme && theme.StickyHeader && typeof theme.sticky_nav_height != 'undefined' ) { 3402 if ( elementorFrontend.elements.$wpAdminBar.length ) { 3403 scrollTop += elementorFrontend.elements.$wpAdminBar.height(); 3404 } 3405 scrollTop = scrollTop - theme.adminBarHeight() - theme.StickyHeader.sticky_height - theme.sticky_nav_height + 1; 3406 } 3407 return scrollTop; 3408 } ); 3409 elementorFrontend.elements.$window.on( 'elementor/nested-tabs/activate', function( e, content ) { 3410 var _tabCarousel = $( content ).find( '.owl-carousel' ); 3411 if ( ! _tabCarousel.data( 'owl.carousel' ) ) { 3412 _tabCarousel.themeCarousel( _tabCarousel.data( 'plugin-options' ) ); 3413 } 3414 }); 3415 } 3416 } ); 3417 3418 // widget wysija 3419 $( '#footer .widget_wysija .wysija-submit:not(.btn)' ).addClass( 'btn btn-default' ); 3420 3421 // fixed visual compoer issue which has owl carousel 3422 if ( $( '[data-vc-parallax] .owl-carousel' ).length ) { 3423 theme.requestTimeout( function() { if ( typeof window.vcParallaxSkroll == 'object' ) { window.vcParallaxSkroll.refresh(); } }, 200 ); 3424 } 3425 3426 if ( $( '.page-content > .alignfull, .post-content > .alignfull' ).length ) { 3427 var initAlignFull = function() { 3428 $( '.page-content > .alignfull, .post-content > .alignfull' ).each( function() { 3429 $( 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 ) ) ); 3430 } ); 3431 };
3432 initAlignFull(); 3433 $( window ).smartresize( function() { 3434 initAlignFull(); 3435 } ); 3436 } 3437} )( 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.