1"use strict"; 2// Toggle/Accordion 3function wglAccordionInit() { 4 var item = jQuery('.wgl-accordion'); 5 6 item.each( function() { 7 var header = jQuery(this).find('.wgl-accordion_header'); 8 var content = jQuery(this).find('.wgl-accordion_content'); 9 var acc_type = jQuery(this).data('type'); 10 var speed = 400; 11 header.off("click"); 12 13 header.each( function() { 14 if (jQuery(this).data('default') == 'yes') { 15 jQuery(this).addClass('active'); 16 jQuery(this).next().slideDown(speed); 17 } 18 }) 19 20 header.on('click', function(e) { 21 e.preventDefault(); 22 var $this = jQuery(this); 23 24 if ( acc_type == 'accordion' ) { 25 $this.toggleClass('active'); 26 $this.next().slideToggle(speed); 27 } else if ( acc_type == 'toggle' ) { 28 $this.toggleClass('active'); 29 $this.next().slideToggle(speed); 30 content.not($this.next()).slideUp(speed); 31 header.not($this).removeClass('active'); 32 } 33 }) 34 }) 35} 36 37// Accordion Services 38function wglServicesAccordionInit() { 39 var widgetList = jQuery('.wgl-accordion-services'); 40 41 widgetList.each(function () { 42 var itemClass = '.service__item'; 43 44 jQuery(this).find(itemClass + ':first-child').addClass('active'); 45 46 var item = jQuery(this).find(itemClass); 47 item.on('mouseover', function () { 48 jQuery(this).addClass('active').siblings().removeClass('active'); 49 }); 50 }); 51} 52 53(function($) { 54 jQuery(document).ready(function() { 55 wglAjaxLoad(); 56 }); 57 58 function wglAjaxLoad() { 59 var i, section; 60 var sections = document.getElementsByClassName('wgl_cpt_section'); 61 for (i = 0; i < sections.length; i++) { 62 section = sections[i]; 63 var infinity_item = section.getElementsByClassName('infinity_item'); 64 var load_more = section.getElementsByClassName('load_more_item'); 65 if (infinity_item.length || load_more.length) { 66 wglAjaxInit(section); 67 } 68 } 69 } 70 71 var wait_load = false; 72 var offset_items = 0; 73 var infinity_item; 74 var js_offset; 75 76 function wglAjaxQuery(grid, section, request_data) { 77 if (wait_load) return; 78 wait_load = true; 79 80 if(!request_data.js_offset){ 81 offset_items = request_data.post_count; 82 } 83 84 request_data['offset_items'] = request_data.js_offset 85 ? request_data.js_offset 86 : offset_items; 87 88 request_data['remainings_loading_btn_items_amount'] = request_data.remainings_loading_btn_items_amount; 89 90 request_data['js_offset'] = request_data.js_offset 91 ? request_data.js_offset 92 : offset_items; 93 94 // For the mode_security enabled, removed sql request 95 if (request_data.query && request_data.query.request) { 96 delete request_data.query.request; 97 } 98 99 $.post( 100 wgl_core.ajaxurl, 101 { 102 action: 'wgl_ajax', 103 data: request_data, 104 nonce: wgl_core.nonce 105 }, 106 function(response, status) { 107 var resp, new_items, load_more_hidden, count_products; 108 resp = document.createElement('div'); 109 resp.innerHTML = response; 110 new_items = $('.item', resp); 111 count_products = $('.woocommerce-result-count', resp); 112 113 load_more_hidden = $('.hidden_load_more', resp); 114 115 if (load_more_hidden.length) { 116 jQuery(section) 117 .find('.load_more_wrapper') 118 .fadeOut(300, function() { 119 $(this).remove(); 120 }); 121 } else { 122 jQuery(section) 123 .find('.load_more_wrapper .load_more_item') 124 .removeClass('loading'); 125 } 126 127 jQuery(section) 128 .find('.woocommerce-result-count') 129 .html(jQuery(count_products).html()); 130 131 if ($(grid).hasClass('carousel')) { 132 $(grid) 133 .find('.swiper-wrapper') 134 .append(new_items); 135 $(grid) 136 .find('.swiper-pagination') 137 .remove(); 138 $(grid) 139 .find('.wgl-carousel_swiper')
140 .update(); 141 } else if ($(grid).hasClass('grid')) { 142 new_items = new_items.hide(); 143 $(grid).append(new_items); 144 new_items.fadeIn('slow'); 145 } else { 146 const $items = jQuery(new_items); 147 const $grid = jQuery(grid); 148 149 $items.imagesLoaded(() => { 150 $grid.append($items) 151 .isotope('appended', $items) 152 .isotope('reloadItems'); 153 154 $grid.isotope('once', 'arrangeComplete', () => { 155 wglScrollAnimation(); 156 $grid.isotope('layout'); 157 updateFilter($grid); 158 updateCarousel($grid); 159 wglCursorInit(); 160 }); 161 162 $grid.isotope('layout'); 163 }); 164 } 165 166 // Call video background settings 167 if (typeof jarallax === 'function') { 168 wglParallaxVideo(); 169 } else { 170 jQuery(grid) 171 .find('.parallax-video') 172 .each(function() { 173 jQuery(this).jarallax({ 174 loop: true, 175 speed: 1, 176 videoSrc: jQuery(this).data('video'), 177 videoStartTime: jQuery(this).data('start'), 178 videoEndTime: jQuery(this).data('end') 179 }); 180 }); 181 } 182 183 // Call swiper settings 184 updateCarousel(grid); 185 186 wglScrollAnimation(); 187 // Update Items 188 189 var offset_data = $('.js_offset_items', resp); 190 request_data.js_offset = parseInt(offset_data.data('offset')); 191 192 wait_load = false; 193 } 194 ); 195 } 196 197 function updateCarousel(grid) { 198 if ( jQuery(grid).find('.wgl-carousel_swiper').size() > 0 ) { 199 jQuery(grid) 200 .find('.wgl-carousel_swiper') 201 .each(function() { 202 swiperCarousel(jQuery(this)); 203 if (jQuery(grid).hasClass('blog_masonry')) { 204 jQuery(grid).isotope('layout'); 205 } 206 }); 207 } 208 } 209 210 function wglAjaxInit(section) { 211 var grid, form, data_field, data, request_data, load_more; 212 213 if (section == undefined) { 214 return; 215 } 216 217 // Get grid CPT 218 grid = section.getElementsByClassName('container-grid'); 219 if (!grid.length) { return; } 220 grid = grid[0]; 221 222 // Get form CPT 223 form = section.getElementsByClassName('posts_grid_ajax'); 224 if (!form.length) { return; } 225 form = form[0]; 226 227 // Get field form ajax 228 data_field = form.getElementsByClassName('ajax_data'); 229 if (!data_field.length) { return; } 230 data_field = data_field[0]; 231 232 data = data_field.value; 233 data = JSON.parse(data); 234 request_data = data; 235 236 infinity_item = section.getElementsByClassName('infinity_item'); 237 238 if (infinity_item.length) { 239 infinity_item = infinity_item[0]; 240 if (jQuery(infinity_item).wglIsVisible()) { 241 wglAjaxQuery(grid, section, request_data); 242 } 243 var lastScrollTop = 0; 244 245 jQuery(window).on('resize scroll', function() { 246 if (jQuery(infinity_item).wglIsVisible()) { 247 var st = jQuery(this).scrollTop(); 248 if (st > lastScrollTop) { 249 wglAjaxQuery(grid, section, request_data); 250 } 251 lastScrollTop = st; 252 } 253 }); 254 } 255 256 load_more = section.getElementsByClassName('load_more_item'); 257 if (load_more.length) { 258 load_more = load_more[0]; 259 load_more.addEventListener( 260 'click', 261 function(e) { 262 e.preventDefault(); 263 jQuery(this).addClass('loading'); 264 wglAjaxQuery(grid, section, request_data); 265 }, 266 false 267 ); 268 } 269 } 270 271 function swiperCarousel(grid) { 272 var wglSwiper = {}, 273 config = { 274 effect: "fade", 275 speed: 900, 276 }; 277 278 if ('undefined' === typeof Swiper) { 279 const asyncSwiper = window.elementorFrontend.utils.swiper; 280 new asyncSwiper(grid, config).then((newSwiperInstance) => { 281 var wglSwiper = newSwiperInstance;
282 wglSwiper.update(); 283 }); 284 } else { 285 var wglSwiper = new Swiper(grid[0], config); 286 wglSwiper.update(); 287 } 288 } 289 290 function updateFilter(grid) { 291 jQuery(grid).isotope({ sortBy : 'original-order' }); 292 jQuery('.isotope-filter a').each(function() { 293 var $this = jQuery(this); 294 var data_filter = this.getAttribute('data-filter'); 295 var num; 296 297 if ($this.parent().parent().parent().hasClass('product__filter')) { 298 num = $this 299 .closest('.wgl-products-grid') 300 .find('.product') 301 .filter(data_filter).length; 302 $this 303 .find('.filter_counter') 304 .text(num); 305 } else { 306 num = $this 307 .closest('.wgl-portfolio') 308 .find('.portfolio__item') 309 .filter(data_filter).length; 310 $this 311 .find('.filter_counter') 312 .text(num); 313 } 314 315 if ( 316 num !== 0 317 && $this.hasClass('empty') 318 ) { 319 $this.removeClass('empty').addClass('swiper-slide').parent().parent().trigger('slides_added'); 320 } 321 }); 322 } 323})(jQuery); 324 325function wglScrollAnimation(){ 326 var portfolio = jQuery('.wgl-portfolio_container'); 327 var shop = jQuery('.wgl-products.appear-animation'); 328 var gallery = jQuery('.wgl-gallery_items.appear-animation'); 329 330 //Scroll Animation 331 (function($) { 332 333 var docElem = window.document.documentElement; 334 335 function getViewportH() { 336 var client = docElem['clientHeight'], 337 inner = window['innerHeight']; 338 339 if( client < inner ) 340 return inner; 341 else 342 return client; 343 } 344 345 function scrollY() { 346 return window.pageYOffset || docElem.scrollTop; 347 } 348 349 // http://stackoverflow.com/a/5598797/989439 350 function getOffset( el ) { 351 var offsetTop = 0, offsetLeft = 0; 352 do { 353 if ( !isNaN( el.offsetTop ) ) { 354 offsetTop += el.offsetTop; 355 } 356 if ( !isNaN( el.offsetLeft ) ) { 357 offsetLeft += el.offsetLeft; 358 } 359 } while( el = el.offsetParent ) 360 361 return { 362 top : offsetTop, 363 left : offsetLeft 364 } 365 } 366 367 function inViewport( el, h ) { 368 var elH = el.offsetHeight, 369 scrolled = scrollY(), 370 viewed = scrolled + getViewportH(), 371 elTop = getOffset(el).top, 372 elBottom = elTop + elH, 373 h = h || 0; 374 375 return (elTop + elH * h) <= viewed && (elBottom - elH * h) >= scrolled; 376 } 377 378 function extend( a, b ) { 379 for( var key in b ) { 380 if( b.hasOwnProperty( key ) ) { 381 a[key] = b[key]; 382 } 383 } 384 return a; 385 } 386 387 function AnimOnScroll( el, options ) { 388 this.el = el; 389 this.options = extend( this.defaults, options ); 390 if(this.el.length){ 391 this._init(); 392 } 393 } 394 395 AnimOnScroll.prototype = { 396 defaults : { 397 viewportFactor : 0 398 }, 399 _init : function() { 400 this.items = Array.prototype.slice.call( jQuery(this.el ).children() ); 401 this.itemsCount = this.items.length; 402 this.itemsRenderedCount = 0; 403 this.didScroll = false; 404 this.delay = 100; 405 406 407 var self = this; 408 409 if(typeof imagesLoaded === 'function'){ 410 imagesLoaded( this.el, this._imgLoaded(self)); 411 }else{ 412 this._imgLoaded(self); 413 } 414 415 }, 416 _imgLoaded : function(self) { 417 418 var interval; 419 420 // the items already shown... 421 self.items.forEach( function( el, i ) { 422 if( inViewport( el ) ) { 423 424 self._checkTotalRendered(); 425 if(!jQuery(el).hasClass('show') && !jQuery(el).hasClass('animate') && inViewport( el, self.options.viewportFactor )){ 426 self._itemClass(jQuery(el), self.delay, interval ); 427 self.delay += 200; 428 setTimeout( function() { 429 self.delay = 100; 430 }, 200 ); 431 } 432 } 433 } ); 434 435 // animate on scroll the items inside the viewport 436 window.addEventListener( 'scroll', function() { 437 self._onScrollFn(); 438 }, false ); 439 window.addEventListener( 'resize', function() { 440 self._resizeHandler(); 441 }, false ); 442 }, 443 444 _onScrollFn : function() { 445 var self = this; 446 if( !this.didScroll ) { 447 this.didScroll = true; 448 setTimeout( function() { self._scrollPage(); }, 60 ); 449 } 450 }, 451 _itemClass : function(item_array, delay, interval) { 452 453 interval = setTimeout(function(){ 454 if ( item_array.length) { 455 jQuery(item_array).addClass( 'animate' ); 456 } else { 457 clearTimeout( interval ); 458 } 459 }, delay); 460 461 }, 462 463 _scrollPage : function() { 464 var self = this; 465 var interval; 466
467 this.items.forEach( function( el, i ) { 468 if( !jQuery(el).hasClass('show') && !jQuery(el).hasClass('animate') && inViewport( el, self.options.viewportFactor ) ) { 469 setTimeout( function() { 470 var perspY = scrollY() + getViewportH() / 2; 471 472 self._checkTotalRendered(); 473 self._itemClass(jQuery(el), self.delay, interval); 474 self.delay += 200; 475 setTimeout( function() { 476 self.delay = 100; 477 }, 200 ); 478 479 }, 25 ); 480 } 481 }); 482 this.didScroll = false; 483 }, 484 _resizeHandler : function() { 485 var self = this; 486 function delayed() { 487 self._scrollPage(); 488 self.resizeTimeout = null; 489 } 490 if ( this.resizeTimeout ) { 491 clearTimeout( this.resizeTimeout ); 492 } 493 this.resizeTimeout = setTimeout( delayed, 1000 ); 494 }, 495 _checkTotalRendered : function() { 496 ++this.itemsRenderedCount; 497 if( this.itemsRenderedCount === this.itemsCount ) { 498 window.removeEventListener( 'scroll', this._onScrollFn ); 499 } 500 } 501 } 502 503 // add to global namespace 504 window.AnimOnScroll = AnimOnScroll; 505 506 })(jQuery); 507 508 new AnimOnScroll( portfolio, {} ); 509 new AnimOnScroll( shop, {} ); 510 new AnimOnScroll( gallery, {} ); 511 512} 513// Scroll Up button 514function wglScrollUp() { 515 (function($) { 516 $.fn.goBack = function(options) { 517 var defaults = { 518 scrollTop: jQuery(window).height(), 519 scrollSpeed: 600, 520 fadeInSpeed: 1000, 521 fadeOutSpeed: 500 522 }; 523 var options = $.extend(defaults, options); 524 var $this = $(this); 525 $(window).on('scroll', function() { 526 if ($(window).scrollTop() > options.scrollTop) { 527 $this.addClass('active'); 528 } else { 529 $this.removeClass('active'); 530 } 531 }); 532 $this.on('click', function() { 533 $('html,body').animate( 534 { 535 scrollTop: 0 536 }, 537 options.scrollSpeed 538 ); 539 }); 540 }; 541 })(jQuery); 542 543 jQuery('#scroll_up').goBack(); 544} 545 546function wglBlogMasonryInit() { 547 var blog = jQuery('.blog-posts > .masonry'); 548 if (blog.length) { 549 var blog_dom = blog.get(0); 550 var $grid = imagesLoaded(blog_dom, function () { 551 // initialize masonry 552 //* Wrapped in a short timeout function because $grid.imagesLoaded doesn't reliably lay out correctly 553 setTimeout(function(){ 554 blog.isotope({ 555 layoutMode: 'masonry', 556 masonry: { 557 columnWidth: '.item', 558 }, 559 itemSelector: '.item', 560 percentPosition: true 561 }); 562 jQuery(window).trigger('resize'); 563 }, 250); 564 }); 565 } 566} 567// WGL Carousel 568function wglCarouselSwiper() { 569 var carousel_2D = jQuery('.wgl-carousel_swiper[data-item-carousel]') 570 var carousel_3D = jQuery('.wgl-carousel.animation-style-3d') 571 572 if (carousel_2D.length) { 573 carousel_2D.each(function (item, value) { 574 var swiperContainer = jQuery(this); 575 var itemID = jQuery(this).data('item-carousel') ? '[data-carousel="' + jQuery(this).data('item-carousel') + '"]' : ''; 576 var effect = jQuery(this).hasClass('fade_swiper') ? 'fade' : 'slide'; 577 578 var configData = jQuery(this).data('swiper') ? jQuery(this).data('swiper') : {}; 579 var speed = configData.speed ? configData.speed / 10 : 300; 580 var autoplay = configData.autoplaySpeed ? configData.autoplaySpeed : 3000; 581 var autoplayEnable = configData.autoplay ? configData.autoplay : false; 582 var loop = configData.infinite ? configData.infinite : false; 583 var adaptiveHeight = configData.adaptiveHeight ? configData.adaptiveHeight : false; 584 var pause_on_hover = configData.autoplayPause ? configData.autoplayPause : false; 585 var centeredSlides = configData.centerMode ? configData.centerMode : false; 586 var reverseDirection = configData.autoplayReverse ? configData.autoplayReverse : false; 587 588 var pagination = swiperContainer.data('pagination') !== undefined ? swiperContainer.data('pagination') : '.swiper-pagination' + itemID;
589 var arrow_next = swiperContainer.data('arrow-next') !== undefined ? swiperContainer.data('arrow-next') : '.elementor-swiper-button-next' + itemID; 590 var arrow_prev = swiperContainer.data('arrow-prev') !== undefined ? swiperContainer.data('arrow-prev') : '.elementor-swiper-button-prev' + itemID; 591 var pagination_type = swiperContainer.hasClass('pagination_fraction') ? 'fraction' : 'bullets'; 592 593 var config = { 594 direction: 'horizontal', 595 loop: loop, 596 speed: speed, 597 effect: effect, 598 slidesPerView: 1, 599 slidesPerGroup: 1, 600 autoHeight: adaptiveHeight, 601 grabCursor: false, 602 paginationClickable: true, 603 centeredSlides: centeredSlides, 604 autoplay: { 605 delay: autoplay, 606 reverseDirection: reverseDirection, 607 }, 608 pagination: { 609 el: pagination, 610 clickable: true, 611 type: pagination_type, 612 formatFractionCurrent: (index) => index > 9 ? '' + index: '0' + index, 613 formatFractionTotal: (index) => index > 9 ? '' + index: '0' + index, 614 renderBullet: (index, className) => '<li class="' + className + '" role="presentation"><button type="button" role="tab" tabindex="-1">' + (index + 1) + '</button></li>', 615 }, 616 navigation: { 617 nextEl: arrow_next, 618 prevEl: arrow_prev 619 }, 620 breakpoints: {}, 621 autoplayEnable: autoplayEnable, 622 pause_on_hover: pause_on_hover, 623 }; 624 625 if (jQuery(this).hasClass('fade_swiper')) { 626 config.fadeEffect = { 627 crossFade: true 628 }; 629 } 630 631 if (configData.responsive) { 632 var obj = {}; 633 configData.responsive.forEach(function (item) { 634 if (item.breakpoint) { 635 obj[item.breakpoint] = { 636 slidesPerView: parseInt(item.slidesToShow), 637 slidesPerGroup: parseInt(item.slidesToScroll) 638 ? parseInt(item.slidesToScroll) 639 : 1, 640 }; 641 642 if (item.gap) { 643 obj[item.breakpoint].spaceBetween = parseInt(item.gap); 644 } 645 } 646 }); 647 648 config.breakpoints = obj; 649 } 650 651 wglInitSwiper(swiperContainer, config); 652 }); 653 } 654 655 /* @see https://3dtransforms.desandro.com/carousel */ 656 if (carousel_3D.length) { 657 carousel_3D.each(function () { 658 var container = jQuery(this), 659 carousel_wrapper = container.find('.wgl-carousel_wrap'), 660 cells = carousel_wrapper.find('.testimonials__wrapper'), 661 direction = container.hasClass('animation-direction-vertical') ? 'rotateX' : 'rotateY'; 662 663 var cell, 664 cellCount = cells.length, 665 cellHeight = carousel_wrapper.outerHeight(), 666 angle, 667 cellAngle, 668 currentCell, 669 selectedIndex = 0, 670 radius, 671 theta; 672 673 function initHeightCarousel() { 674 if ('rotateY' === direction) { 675 var maxHeight = 0; 676 cells.each(function () { 677 var thisH = jQuery(this).outerHeight(); 678 if (thisH > maxHeight) { 679 maxHeight = thisH; 680 } 681 }); 682 container.css({'height': maxHeight}); 683 } 684 } 685 initHeightCarousel(); 686 687 function rotateCarousel() { 688 angle = theta * selectedIndex * -1; 689 carousel_wrapper.css({ 'transform': 'translateZ(' + -radius + 'px) ' + direction + '(' + angle + 'deg)' });
690 } 691 692 container.find('.motion-prev').on('click', function () { 693 throttleFunction(changeCarousel_prev, 200) 694 }); 695 container.find('.motion-next').on('click', function () { 696 throttleFunction(changeCarousel_next, 200) 697 }); 698 699 function changeCarousel_prev() { 700 selectedIndex--; 701 changeCarousel(selectedIndex); 702 } 703 function changeCarousel_next() { 704 selectedIndex++; 705 changeCarousel(selectedIndex); 706 } 707 708 if (container.hasClass('animated-by-mouse-wheel')) { 709 container.on('wheel', function (e) { 710 if (e.originalEvent.deltaY < 0) throttleFunction(changeCarousel_next, 400); 711 else throttleFunction(changeCarousel_prev, 400); 712 e.preventDefault ? e.preventDefault() : (e.returnValue = false); 713 }); 714 } 715 716 function changeCarousel() { 717 cells.removeClass('active current next prev'); 718 theta = 360 / cellCount; 719 720 if ('rotateX' === direction) { 721 radius = Math.round( 722 (cellHeight / cellCount) * 0.7 * Math.sqrt(cellCount / 1.5) 723 ); 724 } else { 725 if (jQuery('#main').width() <= 992) { 726 radius = Math.round( 727 (cellHeight / cellCount) * 0.5 * Math.sqrt(cellCount / 1.2) 728 ); 729 } else { 730 radius = Math.round( 731 (cellHeight / cellCount) * 1.3 * Math.sqrt(cellCount / 1.2) 732 ); 733 } 734 } 735 736 cells.each(function (i) { 737 cell = jQuery(this); 738 cellAngle = theta * i; 739 angle = (theta * selectedIndex * -1) + cellAngle; 740 cell.css({ 'transform': direction + '(' + cellAngle + 'deg) translateZ(' + radius + 'px)' + direction + '(' + (angle * -1) + 'deg) ' }); 741 742 if (selectedIndex < 0) { 743 currentCell = cellCount - (Math.abs(selectedIndex + 1) % cellCount) - 1; 744 } else { 745 currentCell = selectedIndex % cellCount; 746 } 747 748 if (currentCell === i) { 749 cell.addClass('active current'); 750 if (currentCell === 0) cells.last().addClass('active prev'); 751 if (currentCell === cellCount - 1) cells.first().addClass('active next'); 752 } else if (i === (currentCell - 1)) { 753 cell.addClass('active prev') 754 } else if (i === (currentCell + 1)) { 755 cell.addClass('active next') 756 } 757 }); 758 759 rotateCarousel(); 760 761 cells.children().off(); 762 container.find('.prev').children().on('click', changeCarousel_prev); 763 container.find('.next').children().on('click', changeCarousel_next); 764 } 765 766 function throttleFunction(func, interval) { 767 if (!func.lastRunTime || func.lastRunTime < Date.now() - interval) { 768 func.lastRunTime = Date.now(); 769 770 return func.apply(arguments); 771 } 772 } 773 774 // set initials 775 changeCarousel(); 776 jQuery(window).resize(function () { 777 initHeightCarousel(); 778 changeCarousel(); 779 }); 780 }); 781 } 782} 783 784function wglInitSwiper(swiperContainer, config) { 785 if ( 786 window.elementorFrontend 787 && window.elementorFrontend.utils 788 && window.elementorFrontend.utils.swiper 789 ) { 790 const asyncSwiper = window.elementorFrontend.utils.swiper; 791 new asyncSwiper(swiperContainer, config).then((newSwiperInstance) => { 792 var wglSwiper = newSwiperInstance; 793 wglSwiperControl(wglSwiper, swiperContainer, config); 794 }); 795 } else if ('undefined' !== typeof Swiper) { 796 var wglSwiper = new Swiper(swiperContainer[0], config); 797 wglSwiperControl(wglSwiper, swiperContainer, config); 798 } 799} 800 801function wglSwiperControl(element, swiperContainer, config){
802 if (!config.autoplayEnable) { 803 element.autoplay.stop(); 804 } 805 806 if (config.pause_on_hover && config.autoplayEnable) { 807 swiperContainer.on('mouseenter', function () { 808 element.autoplay.stop(); 809 }); 810 swiperContainer.on('mouseleave', function () { 811 element.autoplay.start(); 812 }); 813 } 814} 815 816function wglCircuitService() { 817 if (jQuery('.wgl-circuit-service').length) { 818 jQuery('.wgl-circuit-service').each(function(){ 819 var $circle = jQuery(this).find('.wgl-services_icon-wrap'); 820 821 var agle = 360 / $circle.length; 822 var agleCounter = -1; 823 824 $circle.each(function() { 825 var $this = jQuery(this); 826 827 jQuery(this).parents('.wgl-services_item:first-child').addClass('active'); 828 $this.on('mouseover', function(){ 829 jQuery(this).parents('.wgl-services_item').addClass('active').siblings().removeClass('active'); 830 }) 831 832 var percentWidth = (100 * parseFloat($this.css('width')) / parseFloat($this.parent().css('width'))); 833 var curAgle = agleCounter * agle; 834 var radAgle = curAgle * Math.PI / 180; 835 var x = (50 + ((50 - (percentWidth / 2)) * Math.cos(radAgle))) - (percentWidth / 2); 836 var y = (50 + ((50 - (percentWidth / 2)) * Math.sin(radAgle))) - (percentWidth / 2); 837 838 $this.css({ 839 left: x + '%', 840 top: y + '%' 841 }); 842 843 agleCounter++; 844 }); 845 846 }); 847 } 848} 849// wgl Countdown function init 850function wglCountdownInit () { 851 var countdown = jQuery('.wgl-countdown'); 852 if (countdown.length !== 0 ) { 853 countdown.each(function () { 854 var data_atts = jQuery(this).data('atts'); 855 var time = new Date(+data_atts.year, +data_atts.month-1, +data_atts.day, +data_atts.hours, +data_atts.minutes); 856 jQuery(this).countdown({ 857 until: time, 858 padZeroes: true, 859 digits: [ 860 '<span>0</span>', 861 '<span>1</span>', 862 '<span>2</span>', 863 '<span>3</span>', 864 '<span>4</span>', 865 '<span>5</span>', 866 '<span>6</span>', 867 '<span>7</span>', 868 '<span>8</span>', 869 '<span>9</span>', 870 ], 871 format: data_atts.format ? data_atts.format : 'yowdHMS', 872 labels: [data_atts.labels[0],data_atts.labels[1],data_atts.labels[2],data_atts.labels[3],data_atts.labels[4],data_atts.labels[5], data_atts.labels[6], data_atts.labels[7]], 873 labels1: [data_atts.labels[0],data_atts.labels[1],data_atts.labels[2], data_atts.labels[3], data_atts.labels[4], data_atts.labels[5], data_atts.labels[6], data_atts.labels[7]] 874 }); 875 }); 876 } 877} 878// WGL Counter 879function wglCounterInit() { 880 let counters = jQuery('.wgl-counter__value'); 881 if (counters.length) { 882 counters.appear(function() { 883 let from = jQuery(this).data('start-value'), 884 max = jQuery(this).data('end-value'), 885 speed = jQuery(this).data('speed'); 886 887 jQuery(this).countTo({ 888 from: from, 889 to: max, 890 speed: speed, 891 refreshInterval: 10 892 }); 893 }); 894 } 895} 896// WGL Cursor Message 897jQuery(window).on('elementor/frontend/init', function() { 898 wglSectionCursor(); 899}); 900 901function wglCursorInit() { 902 var $device_mode = jQuery('body').attr('data-elementor-device-mode'); 903 if ($device_mode !== 'desktop' && $device_mode !== 'laptop' && $device_mode !== 'widescreen') { 904 return; 905 } 906 907 var cursorPointerWrap = jQuery('#wgl-cursor'); 908 var cursorPointer = jQuery('#wgl-cursor-pointer'); 909 var cursorText = jQuery('.wgl-cursor-text'); 910 911 jQuery(document).on('mousemove', function(e) { 912 cursorPointerWrap.css("transform", `translate3d(calc(${e.clientX}px - 50%), calc(${e.clientY}px - 50%), 0)`); 913 }) 914 915 if (cursorText.length) { 916 cursorText.each(function() { 917 var $this = jQuery(this), 918 append = wglCursorAppend($this), 919 cursorColorBg = $this.attr('data-cursor-color-bg'); 920 921 if ( $this.hasClass('additional-cursor') ) { 922 $this = $this.parent() 923 } 924 925 const appendElement = 'undefined' !== jQuery.type(append) && '' !== jQuery.type(append); 926 let timerId; 927 928 $this.on('mouseenter', function () { 929 if (appendElement) { 930 cursorPointer 931 .empty() 932 .append(jQuery(append)) 933 timerId = setTimeout(() => { 934 cursorPointer.addClass('visible') 935 }, 20); 936 }else{ 937 cursorPointer.css('color',cursorColorBg) 938 } 939 }).on('mouseleave', function(e) { 940 if (appendElement) { 941 clearTimeout(clearTimeout(timerId)); 942 cursorPointer.removeClass('visible') 943 }else{ 944 if ( e.relatedTarget ) { 945 var newTarget = jQuery(e.relatedTarget); 946 if (!newTarget.hasClass('wgl-cursor-text')) { 947 newTarget = newTarget.parents('[data-cursor-color-bg]').eq(0); 948 } 949 if (newTarget.length > 0 && newTarget.hasClass('wgl-cursor-text')) { 950 setTimeout( function() { 951 newTarget.trigger('mouseenter'); 952 }, 0 ); 953 } else { 954 cursorPointer.css('color','var(--bili-cursor-point-color)') 955 } 956 } 957 } 958 }) 959 }) 960 } 961} 962 963var wglCursorAppend = $this => { 964 965 var text = $this.attr('data-cursor-text'), 966 image = $this.attr('data-cursor-image'), 967 color = $this.attr('data-cursor-text-color'), 968 colorBg = $this.attr('data-cursor-text-color-bg'), 969 colorBgChildren = $this.attr('data-cursor-text-color-bg-children'), 970 size = $this.attr('data-cursor-text-size'), 971 newAppend = []; 972 973 if ( 'undefined' !== jQuery.type(image) ) { 974 newAppend = jQuery('<div class="cursor-content cursor-content-image">
974' + image + '</div>') 975 newAppend.css('background-color', colorBg) 976 } else if ( 'undefined' !== jQuery.type(text) ) { 977 newAppend = jQuery('<div class="cursor-content cursor-content-text">' + text + '</div>') 978 newAppend.css('color', color) 979 newAppend.css('font-size', size + 'px') 980 newAppend.css('background-color', colorBg) 981 newAppend.children().children().css('background-color', colorBgChildren) 982 } 983 984 return newAppend[0]; 985 986} 987 988function wglSectionCursor(){ 989 window.elementorFrontend.hooks.addAction( 'frontend/element_ready/section', 990 function( $scope ){ 991 return $scope.each(function () { 992 var self = jQuery(this), 993 itemId = jQuery(this).data('id'); 994 995 var settings = {}, 996 hasProperty = false, 997 arr = []; 998 999 var init = function(){ 1000 if (!window.elementorFrontend.isEditMode()) { 1001 settings = wgl_cursor_settings[0][itemId]; 1002 1003 hasProperty = checkEnabledCursor(settings); 1004 1005 settings = wgl_cursor_settings[0]; 1006 1007 } else { 1008 if (!window.elementor.elements && 1009 !window.elementor.elements.models 1010 ) { 1011 return; 1012 } 1013 1014 window.elementor.elements.models.forEach(function (value) { 1015 if (itemId === value.id) { 1016 settings = value.attributes.settings.attributes; 1017 arr[value.id] = value.attributes.settings.attributes; 1018 } 1019 }); 1020 1021 hasProperty = checkEnabledCursor(settings); 1022 settings = arr; 1023 } 1024 1025 settings = settings[jQuery(self).data('id')] 1026 1027 if (hasProperty) { 1028 1029 var $self = jQuery(self); 1030 $self.addClass('wgl-cursor-text'); 1031 if ('text' === settings['cursor_tooltip_type']) { 1032 settings['tooltip_text'].length ? $self.attr('data-cursor-text', settings['tooltip_text']) : ''; 1033 $self.removeAttr('data-cursor-image data-cursor-color-bg'); 1034 } else if ('image' === settings['cursor_tooltip_type']) { 1035 settings['cursor_thumbnail']['url'].length ? $self.attr('data-cursor-image', '<img src=\'' + settings['cursor_thumbnail']['url'] + '\' alt=\'' + settings['cursor_thumbnail']['alt'] + '\'>') : ''; 1036 $self.removeAttr('data-cursor-text data-cursor-color-bg'); 1037 } else if ('simple' === settings['cursor_tooltip_type']) { 1038 settings['cursor_color_bg'].length ? $self.attr('data-cursor-color-bg', settings['cursor_color_bg']) : ''; 1039 $self.removeAttr('data-cursor-image data-cursor-text'); 1040 } 1041 (settings['tooltip_color_bg'] && '' !== settings['tooltip_color_bg']) ? $self.attr('data-cursor-text-color-bg', settings['tooltip_color_bg']) : ''; 1042 (settings['tooltip_color'] && '' !== settings['tooltip_color']) ? $self.attr('data-cursor-text-color', settings['tooltip_color']) : ''; 1043 (settings['tooltip_size'] && '' !== settings['tooltip_size']['size']) ? $self.attr('data-cursor-text-size', settings['tooltip_size']['size']) : ''; 1044 1045 } else { 1046 1047 self.off().removeClass('wgl-cursor-text').removeAttr('data-cursor-text data-cursor-image data-cursor-text-color-bg data-cursor-text-color data-cursor-text-size data-cursor-color-bg') 1048 jQuery('#wgl-cursor-pointer').empty() 1049 1050 } 1051 } 1052 1053 var checkEnabledCursor = function (settings) { 1054 return !!(settings 1055 && settings.hasOwnProperty('cursor_tooltip') 1056 && '' !== settings.cursor_tooltip); 1057 } 1058 1059 /*Init*/ 1060 init(); 1061 }); 1062 } 1063 ); 1064} 1065 1066function wglDynamicStyles() { 1067 var style = jQuery('#bili-footer-inline-css'); 1068 1069 (function ($) { 1070 $.fn.wglAddDynamicStyles = function () { 1071 if (this.length === 0) { 1072 return this; 1073 } 1074 1075 return this.each(function () { 1076 var $style = '', 1077 self = jQuery(this); 1078 1079 var init = function () { 1080 $style += self.text(); 1081 self.remove(); 1082 appendStyle(); 1083 }, 1084 appendStyle = function () { 1085 jQuery('head').append('<style>' + $style + '</style>'); 1086 }; 1087 1088 // Init 1089 init(); 1090 }); 1091 }; 1092 })(jQuery); 1093 1094 style.wglAddDynamicStyles(); 1095} 1096 1097// wgl Filter Swiper 1098function wglFilterSwiper() { 1099 1100 let filter_swiper = document.querySelectorAll('.wgl-filter_swiper_wrapper, .wgl-tabs_swiper-wrapper .wgl-tabs_headings-wrap'); 1101 filter_swiper.forEach((slider, index)=>{ 1102 if (window.elementorFrontend) { 1103 if (window.elementorFrontend.isEditMode()) { 1104 wglFilterSwiperInit(slider); 1105 }else{ 1106 elementorFrontend.on('components:init', () => {wglFilterSwiperInit(slider)}); 1107 } 1108 } 1109 });
1110} 1111 1112function wglFilterSwiperInit(self) { 1113 if ('undefined' === typeof Swiper) { 1114 const asyncSwiper = window.elementorFrontend.utils.swiper; 1115 new asyncSwiper(self, { 1116 slidesPerView: 'auto', 1117 slideActiveClass: 'slide-active', 1118 }).then((newSwiperInstance) => { 1119 newSwiperInstance.init(); 1120 jQuery(self).on( 'slides_added', function () { 1121 newSwiperInstance.update(); 1122 }); 1123 }); 1124 } else { 1125 const wglSwiper = new Swiper(self, { 1126 slidesPerView: 'auto', 1127 slideActiveClass: 'slide-active', 1128 }); 1129 jQuery(self).on( 'slides_added', function () { 1130 wglSwiper.update(); 1131 }); 1132 } 1133} 1134//https://gist.github.com/chriswrightdesign/7955464 1135function mobilecheck() { 1136 var check = false; 1137 (function(a){if(/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|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(a)||/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 )|sy(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(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); 1138 return check; 1139} 1140 1141//Add Click event for the mobile device 1142var click = mobilecheck() ? ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') : 'click'; 1143 1144function initClickEvent(){ 1145 click = mobilecheck() ? ('ontouchstart' in document.documentElement ? 'touchstart' : 'click') : 'click'; 1146} 1147jQuery(window).on('resize', initClickEvent); 1148 1149/* 1150 ** Plugin for counter shortcode 1151 */ 1152(function($) { 1153 "use strict"; 1154 1155 $.fn.countTo = function(options) { 1156 // merge the default plugin settings with the custom options 1157 options = $.extend({}, $.fn.countTo.defaults, options || {}); 1158 1159 // how many times to update the value, and how much to increment the value on each update 1160 var loops = Math.ceil(options.speed / options.refreshInterval), 1161 increment = (options.to - options.from) / loops; 1162 1163 return $(this).each(function() { 1164 var _this = this, 1165 loopCount = 0, 1166 value = options.from, 1167 interval = setInterval(updateTimer, options.refreshInterval); 1168 1169 function updateTimer() { 1170 value += increment; 1171 loopCount++; 1172 $(_this).html(value.toFixed(options.decimals)); 1173 1174 if (typeof(options.onUpdate) === 'function') { 1175 options.onUpdate.call(_this, value); 1176 } 1177 1178 if (loopCount >= loops) { 1179 clearInterval(interval); 1180 value = options.to; 1181 1182 if (typeof(options.onComplete) === 'function') { 1183 options.onComplete.call(_this, value); 1184 } 1185 } 1186 } 1187 }); 1188 }; 1189 1190 $.fn.countTo.defaults = { 1191 from: 0, // the number the element should start at 1192 to: 100, // the number the element should end at 1193 speed: 1000, // how long it should take to count between the target numbers 1194 refreshInterval: 100, // how often the element should be updated
1195 decimals: 0, // the number of decimal places to show 1196 onUpdate: null, // callback method for every time the element is updated, 1197 onComplete: null // callback method for when the element finishes updating 1198 }; 1199})(jQuery); 1200 1201/* 1202 ** Plugin IF visible element 1203 */ 1204function wglIsVisibleInit (){ 1205 jQuery.fn.wglIsVisible = function (){ 1206 var elementTop = jQuery(this).offset().top; 1207 var elementBottom = elementTop + jQuery(this).outerHeight(); 1208 var viewportTop = jQuery(window).scrollTop(); 1209 var viewportBottom = viewportTop + jQuery(window).height(); 1210 return elementBottom > viewportTop && elementTop < viewportBottom; 1211 } 1212} 1213 1214/* 1215 ** Preloader 1216 */ 1217jQuery(window).load(function(){ 1218 jQuery('#preloader-wrapper').fadeOut(); 1219}); 1220// wgl image comparison 1221function wglImageComparison() { 1222 var item = jQuery('.wgl-image_comparison.cocoen'); 1223 if (item.length !== 0) { 1224 item.each(function() { 1225 jQuery(this).cocoen(); 1226 }); 1227 } 1228} 1229 1230// Images Gallery 1231function wglImagesGallery() { 1232 var item = '.wgl-gallery_item-wrapper', 1233 gallery_masonry = '.gallery-masonry', 1234 gallery_justified = '.gallery-justified'; 1235 1236 if (jQuery(gallery_masonry).length) { 1237 var dom = jQuery(gallery_masonry).get(0); 1238 var iso = jQuery(gallery_masonry).isotope({ 1239 layoutMode: 'masonry', 1240 percentPosition: true, 1241 itemSelector: item 1242 }); 1243 1244 imagesLoaded(dom, function () { 1245 iso.isotope('layout'); 1246 }); 1247 1248 jQuery(window).on('resize', function () { 1249 iso.isotope(); 1250 }); 1251 } 1252 1253 if (jQuery(gallery_justified).length) { 1254 var dom = jQuery(gallery_justified).get(0); 1255 var jus = jQuery(gallery_justified).justifiedGallery({ 1256 rowHeight: deviceData('height'), 1257 margins: deviceData('gap'), 1258 lastRow: 'nojustify', 1259 captions: false, 1260 }); 1261 1262 imagesLoaded(dom, function () { 1263 jus.justifiedGallery(); 1264 }); 1265 1266 jQuery(window).on('resize', function () { 1267 jus.justifiedGallery({ 1268 rowHeight: deviceData('height'), 1269 margins: deviceData('gap'), 1270 }); 1271 }); 1272 } 1273 1274 function deviceData(option) { 1275 var data = jQuery(gallery_justified).data(option); 1276 if (jQuery('#main').width() <= 767) { 1277 data = jQuery(gallery_justified).data('mobile-' + option); 1278 } else if (jQuery('#main').width() <= 1024) { 1279 data = jQuery(gallery_justified).data('tablet-' + option); 1280 } 1281 return data; 1282 } 1283} 1284 1285// Image Layers 1286function wglImgLayers() { 1287 jQuery('.wgl-image-layers').each(function() { 1288 var container = jQuery(this); 1289 var initImageLayers = function() { 1290 container.appear( 1291 function() { 1292 container.addClass('img-layer_animate'); 1293 }, 1294 { done: true } 1295 ); 1296 }; 1297 initImageLayers(); 1298 }); 1299} 1300 1301function wglIsotope() { 1302 jQuery('.isotope').each(function () { 1303 var $isotope = jQuery(this), 1304 rtl = !jQuery('body').hasClass('rtl'); 1305 var properties = { 1306 layoutMode: $isotope.hasClass('fit_rows') ? 'fitRows' : 'masonry', 1307 percentPosition: true, 1308 originLeft: rtl, 1309 itemSelector: '.portfolio__item, .item, .product', 1310 masonry: { 1311 columnWidth: '.pf_item_size, .portfolio__item, .item, .product', 1312 } 1313 }; 1314 1315 $isotope.imagesLoaded().isotope(properties); 1316 wglIsotopeFilterHandler(this); 1317 }); 1318} 1319 1320function wglIsotopeFilterHandler(self) { 1321 var filterNode = jQuery(self).closest('.elementor-widget-container').find('.isotope-filter a'); 1322 1323 filterNode.each(function () { 1324 var $this = jQuery(this), 1325 num, 1326 dataFilter = this.dataset.filter; 1327 1328 if ($this.parent().parent().parent().hasClass('product__filter')) { 1329 num = $this 1330 .closest('.wgl-products-grid') 1331 .find('.product') 1332 .filter(dataFilter).length; 1333 } else { 1334 num = $this 1335 .closest('.wgl-portfolio') 1336 .find('.portfolio__item') 1337 .filter(dataFilter).length; 1338 } 1339 $this.find('.filter_counter').text(num); 1340 1341 if (0 === num) { 1342 // mark empty categories 1343 $this.addClass('empty').removeClass('swiper-slide').parent().parent().trigger('slides_added'); 1344 } 1345 });
1346 1347 filterNode.on('click', function (e) { 1348 e.preventDefault(); 1349 var $this = jQuery(this); 1350 $this.addClass('active').siblings().removeClass('active'); 1351 1352 var dataFilter = $this.attr('data-filter'), 1353 isotopeNode = $this.closest('.elementor-widget-container').find('.isotope'); 1354 1355 isotopeNode.isotope({ filter: dataFilter }); 1356 1357 if (isotopeNode.hasClass('appear-animation')) { 1358 isotopeNode.find('.portfolio__item').addClass('animate'); 1359 } 1360 }); 1361} 1362 1363function wglMenuLavalamp() { 1364 var lavalamp = jQuery( 1365 // menu 1366 '.menu_line_enable > ul' 1367 // woocommerce 1368 + ',.wc-tabs' 1369 ); 1370 lavalamp.each(function () { 1371 jQuery(this).lavalamp(); 1372 }); 1373 1374 setTimeout(function(){ 1375 jQuery('.wgl-tabs.has-lavalamp .wgl-tabs_headings').lavalamp(); 1376 },600); 1377} 1378 1379(function($, window) { 1380 var Lavalamp = function(element, options) { 1381 this.element = $(element).data('lavalamp', this); 1382 this.options = $.extend({}, this.options, options); 1383 1384 this.init(); 1385 }; 1386 1387 Lavalamp.prototype = { 1388 options: { 1389 current: 1390 '.current-menu-ancestor,.current-menu-item,.current-category-ancestor,.current-page-ancestor,.current_page_parent' // menu 1391 + ',.wgl-tabs_header.active' // wgl-tabs 1392 + ',.active', // wc-tabs 1393 items: 1394 'li' // menu 1395 + ',.wgl-tabs_header', // wgl-tabs 1396 bubble: '<div class="lavalamp-object"></div>', 1397 animation: false, 1398 blur: $.noop, 1399 focus: $.noop, 1400 easing: 'easeInOutCubic', // transition timing function 1401 duration: '0.6s' // animation duration 1402 }, 1403 element: null, 1404 current: null, 1405 bubble: null, 1406 _focus: null, 1407 init: function() { 1408 var resizeTimer, 1409 self = this, 1410 child = self.element.children( 1411 'li' // menu 1412 + ',.wgl-tabs_header' // wgl-tabs 1413 ); 1414 1415 this.onWindowResize = function() { 1416 if (resizeTimer) { 1417 clearTimeout(resizeTimer); 1418 } 1419 1420 resizeTimer = setTimeout(function() { 1421 self.reload(); 1422 }, 100); 1423 }; 1424 1425 $(window).bind('resize.lavalamp', this.onWindowResize); 1426 1427 $(child).addClass('lavalamp-item'); 1428 1429 if ( 1430 (this.element.hasClass('wgl-tabs_headings') 1431 || this.element.parent().hasClass('wgl-tabs_headings')) 1432 || 1433 (this.element.hasClass('wc-tabs') 1434 || this.element.parent().hasClass('wc-tabs')) 1435 1436 ) { 1437 // ↓ Tabs widget 1438 this.element.on('click.lavalamp', '.lavalamp-item', function() { 1439 self._move($(this)); 1440 }); 1441 } else { 1442 // ↓ Menu 1443 this.element 1444 .on('mouseenter.lavalamp', '.lavalamp-item', function() { 1445 self.current.each(function() { 1446 self.options.blur.call(this, self); 1447 }); 1448 1449 self._move($(this)); 1450 }) 1451 .on('mouseleave.lavalamp', function() { 1452 if (self.current.index(self._focus) < 0) { 1453 self._focus = null; 1454 1455 self.current.each(function() { 1456 self.options.focus.call(this, self); 1457 }); 1458 1459 self._move(self.current); 1460 } 1461 }); 1462 } 1463 1464 this.bubble = $.isFunction(this.options.bubble) 1465 ? this.options.bubble.call(this, this.element) 1466 : $(this.options.bubble).prependTo(this.element); 1467 1468 self.element.addClass('lavalamp'); 1469 self.element.find('.lavalamp-object').addClass(self.options.easing); 1470 1471 this.reload(); 1472 1473 self.element.addClass("lavalamp_animate") 1474 }, 1475 reload: function() { 1476 this.current = this.element.children(this.options.current); 1477 1478 if (this.current.size() === 0) { 1479 this.current = this.element 1480 .children() 1481 .not('.lavalamp-object') 1482 .eq(0); 1483 } 1484 1485 this._move(this.current, false); 1486 }, 1487 destroy: function() { 1488 if (this.bubble) { 1489 this.bubble.remove(); 1490 } 1491 1492 this.element.unbind('.lavalamp'); 1493 $(window).unbind('resize.lavalamp', this.onWindowResize); 1494 }, 1495 _move: function(el, animate) { 1496 var pos = el.position(); 1497 var cssProperties; 1498 if (el.hasClass('wgl-tabs_header') || el.parent().hasClass('wc-tabs')) { 1499 // ↓ Tabs widget 1500 if(el.closest('.wgl-tabs').hasClass('tabs_lavalamp_align-right')){ 1501 pos.left = Math.round(pos.left + el.outerWidth() - this.bubble.outerWidth()); 1502 }else if(el.closest('.wgl-tabs').hasClass('tabs_lavalamp_align-left')){ 1503 pos.left = Math.round(pos.left); 1504 }else{ 1505 pos.left = Math.round(pos.left + parseInt(el.css('margin-left')) + el.outerWidth() / 2 - this.bubble.outerWidth() / 2); 1506 } 1507 1508 cssProperties = { 1509 WebkitTransitionDuration: this.options.duration, 1510 MozTransitionDuration: this.options.duration, 1511 transitionDuration: this.options.duration, 1512 transform: 'translate('+pos.left+'px)', 1513 opacity: 1, 1514 left: '0px', 1515 }; 1516 1517 }else{ 1518 // ↓ Menu 1519 var child_width = el.children('a').children('span').width() - 2; 1520 1521 pos.left = pos.left + parseInt(el.children('a').css('paddingLeft')) + 1; 1522 1523 cssProperties = { 1524 WebkitTransitionDuration: this.options.duration, 1525 MozTransitionDuration: this.options.duration, 1526 transitionDuration: this.options.duration, 1527 transform: 'translate(' + pos.left + 'px)', 1528 width: 'calc(' + el.children().children().outerWidth(false) + 'px - 3px)', 1529 marginTop: 'calc(' + el.children().children().outerHeight(false) + 'px - 6px)', 1530 }; 1531 } 1532 1533 this._focus = el; 1534 // Animate bubble 1535 this.bubble.css(cssProperties); 1536 1537 } 1538 }; 1539 1540 $.fn.lavalamp = function(options) { 1541 if (typeof options === 'string') { 1542 var instance = $(this).data('lavalamp'); 1543 return instance[options].apply( 1544 instance, 1545 Array.prototype.slice.call(arguments, 1) 1546 ); 1547 } else { 1548 return this.each(function() { 1549 var instance = $(this).data('lavalamp'); 1550 1551 if (instance) { 1552 $.extend(instance.options, options || {}); 1553 instance.reload(); 1554 } else { 1555 new Lavalamp(this, options); 1556 } 1557 }); 1558 } 1559 }; 1560})(jQuery, window); 1561 1562(function( $ ) { 1563 1564 $(document).on('click', '.sl-button', function() { 1565 var button = $(this), 1566 post_id = button.attr('data-post-id'), 1567 security = button.attr('data-nonce'), 1568 iscomment = button.attr('data-iscomment'), 1569 allbuttons; 1570 1571 if (iscomment === '1') { /* Comments can have same id */ 1572 allbuttons = $('.sl-comment-button-'+post_id); 1573 } else { 1574 allbuttons = $('.sl-button-'+post_id); 1575 } 1576 var loader = allbuttons.next('#sl-loader'); 1577 if (post_id !== '') { 1578 $.ajax({
1579 type: 'POST', 1580 url: wgl_core.ajaxurl, 1581 data : { 1582 action : 'wgl_theme_like', 1583 post_id : post_id, 1584 nonce : security, 1585 is_comment : iscomment, 1586 }, 1587 beforeSend: function() { 1588 loader.html(' <div class="loader">Loading...</div>'); 1589 }, 1590 success: function(response) { 1591 var icon = response.icon; 1592 var count = response.count; 1593 allbuttons.html(icon+count); 1594 if (response.status === 'unliked') { 1595 allbuttons.prop('title', button.data('title-like')); 1596 allbuttons.removeClass('liked'); 1597 } else { 1598 allbuttons.prop('title', button.data('title-unlike')); 1599 allbuttons.addClass('liked'); 1600 } 1601 loader.empty(); 1602 } 1603 }); 1604 1605 } 1606 return false; 1607 }); 1608 1609})( jQuery ); 1610// Select Wrapper 1611function wglLinkOverlay() { 1612 jQuery('.wgl-link-overlay').each(function() { 1613 let $this = jQuery(this); 1614 let wrapper = $this.closest('.elementor-widget'); 1615 let zIndexItem = 'auto' !== wrapper.css('z-index') ? wrapper.css('z-index') : false; 1616 let position = $this.data('link-position'); 1617 let $link = false; 1618 1619 if (!zIndexItem) { 1620 $this.css('z-index', zIndexItem); 1621 } 1622 1623 switch (position) { 1624 case "1st": 1625 $link = wrapper.parent(); 1626 break; 1627 case "2nd": 1628 $link = wrapper.parent().parent(); 1629 break; 1630 case "3rd": 1631 $link = wrapper.parent().parent().parent(); 1632 break; 1633 case "column": 1634 $link = wrapper.closest(".elementor-column"); 1635 break; 1636 default: 1637 $link = wrapper.closest(".elementor-section"); 1638 } 1639 1640 if ($link) { 1641 $this.prependTo($link); 1642 wrapper.remove(); 1643 } 1644 }); 1645} 1646function wglLinkScroll() { 1647 jQuery('a.smooth-scroll, .smooth-scroll').on('click', function(event) { 1648 var href; 1649 if (this.tagName == 'A') { 1650 href = jQuery.attr(this, 'href'); 1651 } else { 1652 var that = jQuery(this).find('a'); 1653 href = jQuery(that).attr('href'); 1654 } 1655 jQuery('html, body').animate( 1656 { 1657 scrollTop: jQuery(href).offset().top 1658 }, 1659 500 1660 ); 1661 event.preventDefault(); 1662 }); 1663} 1664 1665function wglMessageAnimInit() { 1666 jQuery('body').on('click', '.message_close_button', function (e) { 1667 jQuery(this).parents('.closable').slideUp(350); 1668 }); 1669} 1670 1671function wglMobileHeader() { 1672 var menu = jQuery('.wgl-mobile-header .mobile_nav_wrapper .wgl-menu-outer_content > .primary-nav > ul'); 1673 var verticalMenu = jQuery('.menu_vertical.elementor-widget-wgl-menu .primary-nav > ul'); 1674 1675 // Create Mobile Menu plugin 1676 (function ($) { 1677 $.fn.wglMobileMenu = function (options) { 1678 var defaults = { 1679 toggleBtn: '.wgl-mobile-header .hamburger-box', 1680 switcher: '.button_switcher', 1681 back: '.back', 1682 overlay: '.wgl-menu_overlay', 1683 anchor: '.menu-item > a[href*=\\#]', 1684 }; 1685 1686 if (this.length === 0) return this; 1687 1688 return this.each(function () { 1689 var wglMenu = {}, 1690 ds = $(this), 1691 sub_menu = jQuery('.mobile_nav_wrapper .primary-nav > ul ul, .mobile_nav_wrapper .primary-nav > ul .wgl-e-container'), 1692 m_width = jQuery('.mobile_nav_wrapper').data('mobileWidth'), 1693 m_toggle = jQuery('.hamburger-box'), 1694 body = jQuery('body'), 1695 stickyMobile = jQuery('.wgl-mobile-header.wgl-sticky-element'), 1696 window_width = jQuery(window).width(), 1697 mobile_width = body.data('mobileWidth') ?? 1200; 1698 1699 var mobile = window_width <= mobile_width; 1700 1701 // Helper Menu 1702 var open = 'is-active', 1703 openSubMenu = 'show_sub_menu', 1704 mobile_on = 'mobile_switch_on', 1705 mobile_off = 'mobile_switch_off', 1706 mobile_switcher = 'button_switcher'; 1707 1708 var init = function () { 1709 wglMenu.settings = $.extend({}, defaults, options); 1710 createButton(); 1711 showMenu(); 1712 }; 1713 var showMenu = function () { 1714 if (jQuery(window).width() <= m_width) { 1715 if (!m_toggle.hasClass(open)) { 1716 createNavMobileMenu(); 1717 } 1718 } else { 1719 resetNavMobileMenu(); 1720 } 1721 }; 1722 var showMenuAfterResize = function(e) { 1723 window_width = jQuery(window).width(); 1724 if (window_width >= mobile_width){ 1725 mobile = false; 1726 showMenu(); 1727 }else if(window_width <= mobile_width && !mobile){ 1728 mobile = true; 1729 showMenu(); // init once on mobile 1730 } 1731 }; 1732 var createNavMobileMenu = function () { 1733 sub_menu.removeClass(openSubMenu); 1734 ds.hide().addClass(mobile_on); 1735 body.removeClass(mobile_on); 1736 }; 1737 var resetNavMobileMenu = function () { 1738 sub_menu.removeClass(openSubMenu); 1739 body.removeClass(mobile_on); 1740 ds.show().removeClass(mobile_on); 1741 m_toggle.removeClass(open); 1742 jQuery('.' + mobile_switcher).removeClass('is-active'); 1743 }; 1744 var createButton = function () { 1745 ds.find('.menu-item-has-children').each(function () { 1746 jQuery(this) 1747 .find('> a') 1748 .append('<span class="' + mobile_switcher + '"></span>'); 1749 }); 1750 }; 1751 var toggleMobileMenu = function (e) { 1752 ds.toggleClass(openSubMenu); 1753 body.toggleClass(mobile_on); 1754 1755 if (body.hasClass(mobile_on)){ 1756 body.removeClass(mobile_off); 1757 wglDisableBodyScroll(true, '.wgl-menu-outer_content'); 1758 }else{ 1759 body.addClass(mobile_off); 1760 wglDisableBodyScroll(false, '.wgl-menu-outer_content'); 1761 } 1762 }; 1763 1764 var toggleLinkDisabled = function (e) { 1765 jQuery(e.target).closest('.wgl-mobile-header').find('.wgl-menu-outer_content').addClass('wgl-disable-inner'); 1766 }; 1767 var tapEndTimer; 1768 var toggleLinkEnabled = function (e) { 1769 if (tapEndTimer) { 1770 clearTimeout(tapEndTimer); 1771 tapEndTimer = null; 1772 } 1773 1774 tapEndTimer = setTimeout(() => { 1775 jQuery(e.target).closest('.wgl-mobile-header').find('.wgl-menu-outer_content').removeClass('wgl-disable-inner'); 1776 }, 250); 1777 }; 1778 1779 var hideSubMenu = function (e) { 1780 if (!jQuery('.button_switcher').is(e.target)) { 1781 jQuery('.mobile_nav_wrapper .menu-item-has-children') 1782 .find('.sub-menu, div.wgl-e-container') 1783 .stop(true) 1784 .slideUp(450) 1785 .removeClass(openSubMenu); 1786 1787 jQuery('.mobile_nav_wrapper .menu-item-has-children') 1788 .find('.button_switcher') 1789 .removeClass(open); 1790 1791 if (jQuery(e.target).closest('.wgl-mobile-header').length && body.hasClass(mobile_on)) { 1792 toggleMobileMenu(); 1793 } 1794 } 1795 }; 1796 var showSubMenu = function (e) { 1797 e.preventDefault(); 1798 var item = jQuery(this).parents('li'); 1799 1800 if (!jQuery(this).hasClass(open)) { 1801 jQuery('.mobile_nav_wrapper .menu-item-has-children') 1802 .not(item) 1803 .find('.sub-menu, div.wgl-e-container') 1804 .stop(true) 1805 .slideUp(450) 1806 .removeClass(openSubMenu); 1807 jQuery('.mobile_nav_wrapper .menu-item-has-children') 1808 .not(item) 1809 .find('.button_switcher') 1810 .removeClass(open); 1811 jQuery('.mobile_nav_wrapper .menu-item-has-children') 1812 .not(item) 1813 .find('a[href*=\\#]') 1814 .removeClass(open); 1815 1816 jQuery(this) 1817 .parent() 1818 .prevAll('.sub-menu, div.wgl-e-container') 1819 .stop(true) 1820 .slideDown(450) 1821 .addClass(openSubMenu); 1822 jQuery(this) 1823 .parent() 1824 .nextAll('.sub-menu, div.wgl-e-container') 1825 .stop(true) 1826 .slideDown(450) 1827 .addClass(openSubMenu); 1828 } else { 1829 jQuery(this) 1830 .parent() 1831 .prevAll('.sub-menu, div.wgl-e-container') 1832 .stop(true) 1833 .slideUp(450) 1834 .removeClass(openSubMenu); 1835 jQuery(this) 1836 .parent() 1837 .nextAll('.sub-menu, div.wgl-e-container') 1838 .stop(true) 1839 .slideUp(450) 1840 .removeClass(openSubMenu); 1841 } 1842 1843 jQuery(this).toggleClass(open); 1844 }; 1845 var eventClose = function (e) { 1846 var container = $('.wgl-menu_outer'); 1847 1848 if ( 1849 !container.is(e.target) && 1850 container.has(e.target).length === 0 && 1851 $('body').hasClass(mobile_on) 1852 ) { 1853 toggleMobileMenu(); 1854 } 1855 }; 1856 var goBack = function (e) { 1857 e.preventDefault(); 1858 jQuery(this).closest('.sub-menu').removeClass(openSubMenu); 1859 jQuery(this).closest('.sub-menu').prev('a').removeClass(open); 1860 jQuery(this) 1861 .closest('.sub-menu') 1862 .prev('a') 1863 .find('.' + mobile_switcher) 1864 .removeClass(open); 1865 }; 1866 var mobileSticky = function(){ 1867 var top = jQuery(stickyMobile).height(); 1868 var y = jQuery(window).scrollTop(); 1869 if ( y >= top ) { 1870 jQuery(stickyMobile).addClass( 'sticky_mobile' ); 1871 } else { 1872 jQuery(stickyMobile).removeClass('sticky_mobile'); 1873 } 1874 }; 1875 1876 // Init 1877 init(); 1878 1879 jQuery(wglMenu.settings.toggleBtn).on(click, toggleMobileMenu); 1880 jQuery(wglMenu.settings.toggleBtn).on('touchstart', toggleLinkDisabled); 1881 jQuery(wglMenu.settings.toggleBtn).on('touchend', toggleLinkEnabled); 1882 jQuery(wglMenu.settings.overlay).on(click, eventClose); 1883 1884 // Switcher menu 1885 jQuery(wglMenu.settings.switcher).on(click, showSubMenu); 1886 jQuery(wglMenu.settings.anchor).on('touchend mouseup', hideSubMenu); 1887 1888 // Go back menu 1889 jQuery(wglMenu.settings.back).on(click, goBack); 1890 1891 let delay_timer; 1892 jQuery( window ).resize( 1893 function() { 1894 clearTimeout(delay_timer); 1895 delay_timer = setTimeout(showMenuAfterResize, 100); 1896 } 1897 ); 1898 1899 if ( stickyMobile.length !== 0 && body.hasClass('admin-bar') ) { 1900 mobileSticky(); 1901 1902 jQuery( window ).scroll( 1903 function() { 1904 if (jQuery(window).width() <= stickyMobile.find('.mobile_nav_wrapper').data('mobileWidth')) { 1905 mobileSticky(); 1906 } 1907 } 1908 ); 1909 jQuery( window ).resize( 1910 function() { 1911 if (jQuery(window).width() <= stickyMobile.find('.mobile_nav_wrapper').data('mobileWidth')) { 1912 mobileSticky(); 1913 } 1914 } 1915 ); 1916 } 1917 }); 1918 }; 1919 })(jQuery); 1920 1921 (function($) { 1922 $.fn.wglVerticalMenu = function(options) { 1923 var defaults = { 1924 "switcher" : ".button_switcher_vertical", 1925 "anchor" : ".menu-item > a[href*=\\#]" 1926 }; 1927 1928 if (this.length === 0) { return this; } 1929 1930 return this.each(function () { 1931 var wglMenu = {}, ds = $(this); 1932 1933 //Helper Menu 1934 var open = "is-active", 1935 openSubMenu = "show_sub_menu", 1936 mobile_on = "menu_vertical_switch_on", 1937 mobile_switcher = "button_switcher_vertical"; 1938 1939 var init = function() { 1940 wglMenu.settings = $.extend({}, defaults, options); 1941 createButton(); 1942 }, 1943 createButton = function() { 1944 ds.find('.menu-item-has-children').each(function() { 1945 jQuery(this).find('> a').append('<span class="'+ mobile_switcher +'"></span>'); 1946 });
1947 }, 1948 toggleMobileMenu = function (e) { 1949 ds.toggleClass(openSubMenu); 1950 body.toggleClass(mobile_on); 1951 1952 if (body.hasClass(mobile_on)){ 1953 wglDisableBodyScroll(true, '.wgl-menu-outer_content'); 1954 }else{ 1955 wglDisableBodyScroll(false, '.wgl-menu-outer_content'); 1956 } 1957 }, 1958 showSubMenu = function(e) { 1959 e.preventDefault(); 1960 var item = jQuery(this).parents('li'); 1961 1962 if (!jQuery(this).hasClass(open)) { 1963 ds.find('.menu-item-has-children') 1964 .not(item) 1965 .find('.sub-menu, div.wgl-e-container') 1966 .stop(true) 1967 .slideUp(450) 1968 .removeClass(openSubMenu); 1969 ds.find('.menu-item-has-children') 1970 .not(item) 1971 .find('.button_switcher') 1972 .removeClass(open); 1973 ds.find('.menu-item-has-children') 1974 .not(item) 1975 .find('a[href*=\\#]') 1976 .removeClass(open); 1977 1978 jQuery(this) 1979 .parent() 1980 .prevAll('.sub-menu, div.wgl-e-container') 1981 .stop(true) 1982 .slideDown(450) 1983 .addClass(openSubMenu); 1984 jQuery(this) 1985 .parent() 1986 .nextAll('.sub-menu, div.wgl-e-container') 1987 .stop(true) 1988 .slideDown(450) 1989 .addClass(openSubMenu); 1990 } else { 1991 jQuery(this) 1992 .parent() 1993 .prevAll('.sub-menu, div.wgl-e-container') 1994 .stop(true) 1995 .slideUp(450) 1996 .removeClass(openSubMenu); 1997 jQuery(this) 1998 .parent() 1999 .nextAll('.sub-menu, div.wgl-e-container') 2000 .stop(true) 2001 .slideUp(450) 2002 .removeClass(openSubMenu); 2003 } 2004 2005 jQuery(this).toggleClass(open); 2006 }, 2007 hideSubMenu = function(e) { 2008 let switcherTarget = ds.find('.button_switcher_vertical'); 2009 if(!switcherTarget.is(e.target)){ 2010 ds.find('.menu-item-has-children') 2011 .find('.sub-menu, div.wgl-e-container') 2012 .stop(true) 2013 .slideUp(450) 2014 .removeClass(openSubMenu); 2015 2016 ds.find('.menu-item-has-children') 2017 .find('.button_switcher') 2018 .removeClass(open); 2019 2020 if (jQuery(e.target).closest('.wgl-mobile-header').length) { 2021 toggleMobileMenu(); 2022 } 2023 } 2024 }; 2025 2026 /*Init*/ 2027 init(); 2028 2029 //switcher menu 2030 ds.find(wglMenu.settings.switcher).on(click, showSubMenu); 2031 ds.find(wglMenu.settings.anchor).on(click, hideSubMenu); 2032 2033 }); 2034 2035 }; 2036 })(jQuery); 2037 2038 menu.wglMobileMenu(); 2039 verticalMenu.wglVerticalMenu(); 2040} 2041 2042var wglDisableBodyScroll = (function () { 2043 2044 var _selector = false, 2045 _element = false, 2046 _clientY; 2047 2048 if (!Element.prototype.matches) 2049 Element.prototype.matches = Element.prototype.msMatchesSelector || 2050 Element.prototype.webkitMatchesSelector; 2051 2052 if (!Element.prototype.closest) 2053 Element.prototype.closest = function (s) { 2054 var ancestor = this; 2055 if (!document.documentElement.contains(el)) return null; 2056 do { 2057 if (ancestor.matches(s)) return ancestor; 2058 ancestor = ancestor.parentElement; 2059 } while (ancestor !== null); 2060 return el; 2061 }; 2062 2063 var preventBodyScroll = function (event) { 2064 if (false === _element || !event.target.closest(_selector)) { 2065 event.preventDefault(); 2066 } 2067 }; 2068 2069 var captureClientY = function (event) { 2070 if (event.targetTouches.length === 1) { 2071 _clientY = event.targetTouches[0].clientY; 2072 } 2073 }; 2074 2075 var preventOverscroll = function (event) { 2076 if (event.targetTouches.length !== 1) { 2077 return; 2078 } 2079 2080 var clientY = event.targetTouches[0].clientY - _clientY; 2081 2082 if (_element.scrollTop === 0 && clientY > 0) { 2083 event.preventDefault(); 2084 } 2085 2086 if ((_element.scrollHeight - _element.scrollTop <= _element.clientHeight) && clientY < 0) { 2087 event.preventDefault(); 2088 } 2089 }; 2090 2091 return function (allow, selector) { 2092 if (typeof selector !== "undefined") { 2093 _selector = selector; 2094 _element = document.querySelector(selector); 2095 } 2096 2097 if (true === allow) { 2098 if (false !== _element) { 2099 _element.addEventListener('touchstart', captureClientY, false); 2100 _element.addEventListener('touchmove', preventOverscroll, false); 2101 } 2102 document.body.addEventListener("touchmove", preventBodyScroll, false); 2103 } else { 2104 if (false !== _element) { 2105 _element.removeEventListener('touchstart', captureClientY, false); 2106 _element.removeEventListener('touchmove', preventOverscroll, false); 2107 } 2108 document.body.removeEventListener("touchmove", preventBodyScroll, false); 2109 } 2110 }; 2111}()); 2112// wgl Page Title Parallax 2113function wglPageTitleParallax() { 2114 var page_title = jQuery('.page-header.page_title_parallax') 2115 if (page_title.length !== 0 ) { 2116 page_title.paroller(); 2117 } 2118} 2119 2120// wgl Extended Parallax 2121function wglExtendedParallax() { 2122 var item = jQuery('.extended-parallax') 2123 if (item.length !== 0 ) { 2124 item.each( function() { 2125 jQuery(this).paroller(); 2126 }) 2127 } 2128} 2129// wgl Portfolio Single Parallax 2130function wglPortfolioParallax() { 2131 var portfolio = jQuery('.wgl-portfolio-item_bg.portfolio_parallax') 2132 if (portfolio.length !== 0 ) { 2133 portfolio.paroller(); 2134 } 2135} 2136 2137function wglParallaxVideo() { 2138 jQuery('.parallax-video').each(function() { 2139 jQuery(this).jarallax({ 2140 loop: true, 2141 speed: 1, 2142 videoSrc: jQuery(this).data('video'), 2143 videoStartTime: jQuery(this).data('start'), 2144 videoEndTime: jQuery(this).data('end') 2145 }); 2146 });
2147} 2148 2149function wglParticlesCustom() { 2150 jQuery('.wgl-particles-js').each(function() { 2151 var id = jQuery(this).attr('id'); 2152 var type = jQuery(this).data('particles-type'); 2153 var color_type = jQuery(this).data('particles-colors-type'); 2154 var color = jQuery(this).data('particles-color'); 2155 var color_line = jQuery(this).data('particles-color'); 2156 var number = jQuery(this).data('particles-number'); 2157 var lines = jQuery(this).data('particles-line'); 2158 var size = jQuery(this).data('particles-size'); 2159 var speed = jQuery(this).data('particles-speed'); 2160 var hover = jQuery(this).data('particles-hover'); 2161 var hover_mode = jQuery(this).data('particles-hover-mode'); 2162 switch (type) { 2163 case 'particles': 2164 default: 2165 type = 'circle'; 2166 break; 2167 case 'hexagons': 2168 type = 'polygon'; 2169 break; 2170 } 2171 if (color_type == 'random_colors') { 2172 color = color.split(','); 2173 color_line = color[0]; 2174 } 2175 2176 tsParticles.load(id, { 2177 particles: { 2178 number: { 2179 value: number, 2180 density: { 2181 enable: true, 2182 value_area: 800 2183 } 2184 }, 2185 color: { 2186 value: color 2187 }, 2188 shape: { 2189 type: type, 2190 polygon: { 2191 nb_sides: 6 2192 } 2193 }, 2194 opacity: { 2195 value: 1, 2196 random: true, 2197 anim: { 2198 enable: false, 2199 speed: 1, 2200 opacity_min: 0.1, 2201 sync: false 2202 } 2203 }, 2204 size: { 2205 value: size, 2206 random: true, 2207 anim: { 2208 enable: false, 2209 speed: 30, 2210 size_min: 1, 2211 sync: false 2212 } 2213 }, 2214 line_linked: { 2215 enable: lines, 2216 distance: 150, 2217 color: color_line, 2218 opacity: 0.4, 2219 width: 1 2220 }, 2221 move: { 2222 enable: true, 2223 speed: speed, 2224 direction: 'none', 2225 random: false, 2226 straight: false, 2227 out_mode: 'out', 2228 bounce: false, 2229 attract: { 2230 enable: false, 2231 rotateX: 600, 2232 rotateY: 1200 2233 } 2234 } 2235 }, 2236 interactivity: { 2237 detect_on: 'canvas', 2238 events: { 2239 onhover: { 2240 enable: hover, 2241 mode: hover_mode 2242 }, 2243 onclick: { 2244 enable: true, 2245 mode: 'push' 2246 }, 2247 resize: true 2248 }, 2249 modes: { 2250 grab: { 2251 distance: 150, 2252 line_linked: { 2253 opacity: 1 2254 } 2255 }, 2256 bubble: { 2257 distance: 200, 2258 size: size * 1.6, 2259 duration: 20, 2260 opacity: 1, 2261 speed: 30 2262 }, 2263 repulse: { 2264 distance: 80, 2265 duration: 0.4 2266 }, 2267 push: { particles_nb: 4 }, 2268 remove: { particles_nb: 2 } 2269 } 2270 }, 2271 retina_detect: true 2272 }); 2273 var update; 2274 update = function() { 2275 requestAnimationFrame(update); 2276 }; 2277 requestAnimationFrame(update); 2278 });
2279} 2280 2281function wglParticlesImageCustom() { 2282 2283 jQuery('.wgl-particles-img-js').each(function () { 2284 var id = jQuery(this).attr('id'); 2285 var color = jQuery(this).data('particles-color') || "#000000"; 2286 2287 var number = jQuery(this).data('particles-number'); 2288 var lines = jQuery(this).data('particles-line'); 2289 var size = jQuery(this).data('particles-size'); 2290 var speed = jQuery(this).data('particles-speed'); 2291 var hover = jQuery(this).data('particles-hover'); 2292 var hover_mode = jQuery(this).data('particles-hover-mode'); 2293 var rotate = jQuery(this).data('particles-rotate'); 2294 rotate = rotate === 'yes' ? true : false; 2295 var rotate_speed = jQuery(this).data('particles-rotate-animation') || 0; 2296 2297 var img_src = jQuery(this).data('image').split(","); 2298 2299 var imageElement = []; 2300 2301 img_src.forEach(function (item, i, arr) { 2302 var url = new URL(item); 2303 var element = {}; 2304 element.height = url.searchParams.get('height'); 2305 element.replaceColor = true; 2306 element.src = item.split('?')[0]; 2307 element.width = url.searchParams.get('width'); 2308 element.fill = true; 2309 element.close = true; 2310 imageElement.push(element); 2311 }); 2312 2313 tsParticles.load(id, { 2314 "detectRetina": true, 2315 "fpsLimit": 60, 2316 "particles": { 2317 "number": { 2318 "value": number, 2319 "density": { 2320 "enable": true, 2321 "area": 800 2322 }, 2323 "limit": 0, 2324 }, 2325 "color": { 2326 "value": color 2327 }, 2328 "shape": { 2329 "image": imageElement, 2330 "polygon": { 2331 "close": true, 2332 "fill": true, 2333 "sides": 5 2334 }, 2335 "type": "image", 2336 "custom": {} 2337 }, 2338 "opacity": { 2339 "animation": { 2340 "enable": false, 2341 "minimumValue": 0.1, 2342 "speed": 1, 2343 "sync": false 2344 }, 2345 "random": { 2346 "enable": false, 2347 "minimumValue": 1 2348 }, 2349 "value": 1 2350 }, 2351 "size": { 2352 "animation": { 2353 "enable": false, 2354 "minimumValue": 1, 2355 "speed": 40, 2356 "sync": false 2357 }, 2358 "random": { 2359 "enable": false, 2360 "minimumValue": 1 2361 }, 2362 "value": size 2363 }, 2364 2365 "lineLinked": { 2366 "blink": false, 2367 "color": { 2368 "value": color 2369 }, 2370 "consent": false, 2371 "distance": 150, 2372 "enable": lines, 2373 "opacity": 0.4, 2374 "width": 1 2375 }, 2376 "move": { 2377 "collisions": false, 2378 "direction": "none", 2379 "enable": true, 2380 "outMode": "out", 2381 "random": false, 2382 "speed": speed, 2383 "straight": false, 2384 "attract": { 2385 "enable": false, 2386 "rotate": { 2387 "x": 600, 2388 "y": 1200 2389 } 2390 }, 2391 }, 2392 "rotate": { 2393 "animation": { 2394 "enable": rotate, 2395 "speed": rotate_speed, 2396 "sync": false 2397 }, 2398 "direction": "random", 2399 "random": true, 2400 "value": 0 2401 }, 2402 "stroke": { 2403 "color": { 2404 "value": color 2405 }, 2406 "width": 0, 2407 "opacity": 1 2408 } 2409 }, 2410 "interactivity": { 2411 "detectsOn": "canvas", 2412 "events": { 2413 "onClick": { 2414 "enable": false, 2415 "mode": "push" 2416 }, 2417 "onHover": { 2418 "enable": hover, 2419 "mode": hover_mode, 2420 "parallax": { 2421 "enable": false, 2422 "force": 60, 2423 "smooth": 10 2424 } 2425 }, 2426 "resize": true 2427 }, 2428 "modes": { 2429 "bubble": { 2430 "distance": 200, 2431 "duration": 20, 2432 "opacity": 1, 2433 "size": size * 1.6, 2434 }, 2435 "connect": { 2436 "distance": 80, 2437 "lineLinked": { 2438 "opacity": 0.5 2439 }, 2440 "radius": 60 2441 }, 2442 "grab": { 2443 "distance": 150, 2444 "lineLinked": { 2445 "opacity": 1, 2446 } 2447 }, 2448 "push": { 2449 "quantity": 4 2450 }, 2451 "remove": { 2452 "quantity": 2 2453 }, 2454 "repulse": { 2455 "distance": 200, 2456 "duration": 0.4 2457 }, 2458 "slow": { 2459 "factor": 1, 2460 "radius": 0 2461 } 2462 } 2463 }, 2464 "backgroundMask": { 2465 "cover": { 2466 "color": { 2467 "value": "#fff" 2468 }, 2469 "opacity": 1 2470 }, 2471 "enable": false 2472 }, 2473 "pauseOnBlur": true, 2474 "background": {} 2475 }); 2476 2477 var update; 2478 update = function () { 2479 requestAnimationFrame(update); 2480 }; 2481 requestAnimationFrame(update); 2482 2483 2484 2485 });
2486} 2487 2488// wgl Pie Chart 2489function wglPieChartInit() { 2490 2491 var item = jQuery('.wgl-pie_chart'); 2492 2493 if (item.length) { 2494 item.each(function() { 2495 var chart = item.find('.chart'); 2496 2497 item.appear(function() { 2498 jQuery(chart).easyPieChart({ 2499 barColor: jQuery(this).data("barColor"), 2500 trackColor: jQuery(this).data("trackColor"), 2501 scaleColor: false, 2502 lineCap: 'square', 2503 lineWidth: jQuery(this).data("lineWidth"), 2504 animate: { duration: 1400, enabled: true }, 2505 size: jQuery(this).data("size"), 2506 onStep: function(from, to, percent) { 2507 jQuery(this.el).find('.chart__percent').text(Math.round(percent) + '%'); 2508 } 2509 }); 2510 }); 2511 }); 2512 } 2513} 2514// http://brutaldesign.github.io/swipebox/ 2515function wglVideoboxInit() { 2516 var gallery = jQuery(".videobox, .swipebox, .gallery a[href$='.jpg'], .gallery a[href$='.jpeg'], .gallery a[href$='.JPEG'], .gallery a[href$='.gif'], .gallery a[href$='.png']"); 2517 if (gallery.length !== 0 ) { 2518 gallery.each(function() { 2519 jQuery(this).attr('data-elementor-open-lightbox', 'yes'); 2520 }); 2521 } 2522} 2523// WGL Progress Bar 2524function wglProgressBarsInit(item) { 2525 var widgetSelector = '.wgl-progress-bar'; 2526 var widgetEl = item ? jQuery(item).find(widgetSelector) : jQuery(widgetSelector); 2527 2528 widgetEl.each(function () { 2529 var item = jQuery(this); 2530 var bar = item.find('.bar__filled'); 2531 2532 var porgressValue = bar.data('value'); 2533 var maximumValue = bar.data('max-value'); 2534 2535 porgressValue = porgressValue < 0 ? 0 : porgressValue; 2536 porgressValue = porgressValue > maximumValue ? maximumValue : porgressValue; 2537 2538 if (!porgressValue || !maximumValue) { 2539 // Bailout. 2540 return; 2541 } 2542 2543 var slidableLabel = item.hasClass('layout-dynamic'); 2544 var contentWrapper = item.find('.progress__content'); 2545 var counter = item.find('.value__digit'); 2546 var duration = parseFloat(bar.css('transition-duration')) * 1000; 2547 var interval = porgressValue ? Math.floor(duration / porgressValue) : 0; 2548 var progressWidth = (porgressValue / maximumValue) * 100; 2549 var imcrementedValue = 0; 2550 2551 item.appear(function () { 2552 bar.css('width', progressWidth + '%'); 2553 2554 if (slidableLabel) { 2555 contentWrapper.css('width', progressWidth + '%'); 2556 } 2557 2558 var imcrementCounter = setInterval(function () { 2559 counter.text(imcrementedValue++); 2560 }, interval); 2561 2562 var stopCounter = setTimeout(function () { 2563 clearInterval(imcrementCounter); 2564 counter.text(porgressValue); 2565 }, duration); 2566 }); 2567 }); 2568} 2569 2570function wglSearchInit() { 2571 2572 // Create plugin Search 2573 (function($) { 2574 2575 $.fn.wglSearch = function(options) { 2576 var defaults = { 2577 'toggleID' : '.header_search-button', 2578 'closeID' : '.header_search-close', 2579 'searchField' : '.header_search-field', 2580 'body' : 'body > *:not(header)', 2581 }; 2582 2583 if (this.length === 0) { return this; } 2584 2585 return this.each(function() { 2586 var wglSearch = {}, 2587 s = $(this), 2588 openClass = 'header_search-open', 2589 searchClass = '.header_search', 2590 2591 init = function() { 2592 wglSearch.settings = $.extend({}, defaults, options); 2593 }, 2594 open = function() { 2595 $(s).addClass(openClass); 2596 setTimeout(function() { 2597 $(s) 2598 .find('input.search-field') 2599 .focus(); 2600 }, 400); 2601 return false; 2602 }, 2603 close = function() { 2604 $(s).removeClass(openClass); 2605 }, 2606 toggleSearch = function(e) { 2607 if (! $(s).closest(searchClass).hasClass(openClass)) { 2608 open(); 2609 } else { 2610 close(); 2611 } 2612 }, 2613 eventClose = function(e) { 2614 if (! $(e.target).closest('.search-form').length) { 2615 if ($(searchClass).hasClass(openClass)) { 2616 close(); 2617 } 2618 } 2619 }; 2620 $(document).bind('keydown', function(e) { 2621 if (e.which === 27 && $(searchClass).hasClass(openClass)) close(); 2622 }); 2623 2624 // Init 2625 init(); 2626 2627 if ($(this).hasClass('search_standard') || $(this).hasClass('search_standard_fw')) { 2628 $(this).find(wglSearch.settings.toggleID).on(click, toggleSearch); 2629 $(this).find(wglSearch.settings.closeID).on(click, eventClose); 2630 } else { 2631 $(wglSearch.settings.toggleID).on(click, toggleSearch); 2632 $(wglSearch.settings.searchField).on(click, eventClose); 2633 } 2634 2635 $(wglSearch.settings.body).on(click, eventClose); 2636 2637 }); 2638 2639 }; 2640 2641 })(jQuery); 2642 2643 jQuery('.header_search').wglSearch(); 2644 2645} 2646// Showcase 2647 2648function wglShowcaseInit() { 2649 let $showcase = jQuery('.wgl-showcase.slide-showcase, .wgl-showcase.fade_bg-showcase'); 2650 if ($showcase.length) { 2651 $showcase.each(function(){
2652 let $this = jQuery(this), 2653 image = $this.find('.showcase__image'), 2654 title = $this.find('.showcase__title'); 2655 2656 image.eq(0).addClass("active"); 2657 title.eq(0).addClass("active"); 2658 2659 let indexItem = $this.find('.wgl-double-heading'); 2660 indexItem = indexItem.length > 0 ? 1 : 0; 2661 title.on('touchstart mouseenter', function(){ 2662 let obj = jQuery(this); 2663 if(!obj.hasClass("active")){ 2664 image.removeClass("active").eq(obj.index() - indexItem).addClass("active"); 2665 title.removeClass("active").eq(obj.index() - indexItem).addClass("active"); 2666 } 2667 }).on("touchend mouseleave", function () { 2668 let obj = jQuery(this); 2669 if(!obj.hasClass("active")){ 2670 image.removeClass("active").eq(obj.index() - indexItem).addClass("active"); 2671 title.removeClass("active").eq(obj.index() - indexItem).addClass("active"); 2672 } 2673 }); 2674 2675 $this.addClass("showcase__init"); 2676 }) 2677 } 2678} 2679function wglSidePanelInit() { 2680 2681 // Create plugin Side Panel 2682 (function($) { 2683 2684 $.fn.wglSidePanel = function(options) { 2685 var defaults = { 2686 "toggleID" : ".side_panel-toggle", 2687 "closeID" : ".side-panel_close", 2688 "closeOverlay" : ".side-panel_overlay", 2689 "body" : "body > *:not(header)", 2690 "sidePanel" : "#side-panel .side-panel_sidebar" 2691 }; 2692 2693 if (this.length === 0) { return this; } 2694 2695 return this.each(function () { 2696 var wglSidePanel = {}, 2697 s = $(this), 2698 openClass = 'side-panel_open', 2699 wglScroll, 2700 sidePanelClass = '.side_panel', 2701 $side_panel = $('#side-panel'), 2702 2703 init = function() { 2704 wglSidePanel.settings = $.extend({}, defaults, options); 2705 }, 2706 open = function () { 2707 if (! $side_panel.hasClass('side-panel_active')) { 2708 $side_panel.addClass('side-panel_active'); 2709 } 2710 2711 $side_panel.addClass(openClass); 2712 $(s).addClass(openClass); 2713 $('body').removeClass('side-panel--closed').addClass('side-panel--opened'); 2714 2715 var wglClassAnimated = $side_panel.find('section.elementor-element').data('settings'); 2716 if (wglClassAnimated && wglClassAnimated.animation) { 2717 $side_panel.find('section.elementor-element').removeClass('elementor-invisible').addClass('animated').addClass(wglClassAnimated.animation); 2718 } 2719 }, 2720 close = function () { 2721 $(s).removeClass(openClass); 2722 $side_panel.removeClass(openClass); 2723 $('body').removeClass('side-panel--opened').addClass('side-panel--closed'); 2724 var wglClassAnimated = $side_panel.find('section.elementor-element').data('settings'); 2725 if (wglClassAnimated && wglClassAnimated.animation) { 2726 $side_panel.find('section.elementor-element').removeClass(wglClassAnimated.animation); 2727 } 2728 }, 2729 togglePanel = function(e) { 2730 e.preventDefault(); 2731 wglScroll = $(window).scrollTop(); 2732 2733 if (! $(s).closest(sidePanelClass).hasClass(openClass)) { 2734 open(); 2735 $(window).scroll(function() { 2736 if (450 < Math.abs($(this).scrollTop() - wglScroll)) { 2737 close(); 2738 } 2739 }); 2740 } else { 2741 2742 } 2743 }, 2744 closePanel = function(e) { 2745 e.preventDefault(); 2746 if ($(s).closest(sidePanelClass).hasClass(openClass)) { 2747 close(); 2748 } 2749 }, 2750 eventClose = function(e) { 2751 var element = $(sidePanelClass); 2752 2753 if (! $side_panel.is(e.target) && $side_panel.has(e.target).length === 0) { 2754 if ($(element).hasClass(openClass)) { 2755 close(); 2756 } 2757 } 2758 }; 2759 2760 init(); 2761 2762 $(wglSidePanel.settings.toggleID).on(click, togglePanel); 2763 $(wglSidePanel.settings.body).on(click, eventClose); 2764 $(wglSidePanel.settings.closeID).on(click, closePanel); 2765 $(wglSidePanel.settings.closeOverlay).on(click, closePanel); 2766 2767 $(document).bind('keydown', function(e) { 2768 if (e.which === 27 && $(sidePanelClass).hasClass(openClass)) close(); 2769 }); 2770 }); 2771 }; 2772 2773 })(jQuery); 2774 2775 if (jQuery('#side-panel').length) { 2776 jQuery('.side_panel').wglSidePanel(); 2777 } 2778} 2779function wglSkrollrInit() { 2780 var blog_scroll = jQuery('.blog_skrollr_init'); 2781 if (blog_scroll.length) {
2782 if ( !/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i.test(navigator.userAgent || navigator.vendor || window.opera) ) { 2783 // wgl Skrollr 2784 skrollr.init({ 2785 smoothScrolling: false, 2786 forceHeight: false 2787 }); 2788 } 2789 } 2790} 2791 2792function wglStickyInit() { 2793 2794 var $header = jQuery('.wgl-theme-header'), 2795 $stickyHeader = jQuery('.wgl-sticky-header'), 2796 $noticesWrapper = jQuery('.wgl_notices_wrapper'), 2797 $mobileSticky = $header.find('.wgl-mobile-header.wgl-sticky-element'), 2798 stickyHeight = $stickyHeader.length !== 0 ? $stickyHeader.height() : 0, 2799 data = $stickyHeader.length !== 0 ? $stickyHeader.data('style') : 'none', 2800 m_width = jQuery('body').data( "mobileWidth" ), 2801 previousScroll = 0, 2802 previousScrollNotice = 0; 2803 2804 const scrollSize = jQuery(window).scrollTop(); 2805 2806 function init(element) { 2807 if ( ! element || m_width >= jQuery(window).width() ) { 2808 $stickyHeader.removeClass('sticky_active'); 2809 return; 2810 } 2811 2812 let scrollSize = jQuery(window).scrollTop(); 2813 if ( data === 'standard' ) { 2814 if ( scrollSize >= stickyHeight && 0 !== stickyHeight ) { 2815 $stickyHeader.addClass( 'sticky_active' ); 2816 } else { 2817 $stickyHeader.removeClass( 'sticky_active' ); 2818 } 2819 } else { 2820 if ( scrollSize > stickyHeight ) { 2821 if ( scrollSize > previousScroll ) { 2822 $stickyHeader.removeClass( 'sticky_active' ); 2823 } else { 2824 $stickyHeader.addClass( 'sticky_active' ); 2825 } 2826 } else { 2827 $stickyHeader.removeClass('sticky_active'); 2828 } 2829 } 2830 previousScroll = scrollSize; 2831 }; 2832 function initNoticeSticky(element) { 2833 let scrollSize = jQuery(window).scrollTop(); 2834 if ( scrollSize > stickyHeight ) { 2835 $noticesWrapper.removeClass( 'stick_home' ); 2836 if ( scrollSize > previousScrollNotice || 0 === stickyHeight || m_width >= jQuery(window).width() ) { 2837 $noticesWrapper.addClass( 'stick_top' ); 2838 } else { 2839 $noticesWrapper.removeClass( 'stick_top' ); 2840 } 2841 } else { 2842 $noticesWrapper.addClass( 'stick_home' ).removeClass( 'stick_top' ); 2843 } 2844 previousScrollNotice = scrollSize; 2845 } 2846 2847 if ( $noticesWrapper.length !== 0 ) { 2848 function setCss() { 2849 $noticesWrapper.css({ 2850 '--height': $header.height() + 'px', 2851 '--sticky-height': stickyHeight + 'px', 2852 '--mobile-sticky-height': $mobileSticky.length !== 0 ? $mobileSticky.height() + 'px' : '0', 2853 'opacity': 1 2854 }); 2855 } 2856 if (scrollSize === 0) { 2857 $noticesWrapper.addClass('stick_home'); 2858 }else if(scrollSize >= stickyHeight) { 2859 $noticesWrapper.addClass( 'stick_top' ); 2860 } 2861 2862 setCss(); 2863 jQuery( window ).scroll( function() { 2864 initNoticeSticky(jQuery(this)); 2865 } ); 2866 jQuery( window ).resize( function() { 2867 initNoticeSticky(jQuery(this)); 2868 setCss(); 2869 } ); 2870 } 2871 2872 if ( $stickyHeader.length !== 0 ) { 2873 jQuery( window ).scroll( function() { 2874 init(jQuery(this)); 2875 } ); 2876 2877 jQuery( window ).resize( function() { 2878 init(jQuery(this)); 2879 } ); 2880 } 2881} 2882function wglStickySidebar() { 2883 if (jQuery('.sticky-sidebar').length) { 2884 jQuery('body').addClass('sticky-sidebar_init'); 2885 jQuery('.sticky-sidebar').each(function() { 2886 var $this = jQuery(this), 2887 stickyOffsetTop = $this.css('--wgl-sticky-offset-t'); 2888 2889 $this.theiaStickySidebar({ 2890 additionalMarginTop: !!stickyOffsetTop ? stickyOffsetTop : 150, 2891 additionalMarginBottom: 30 2892 }); 2893 }); 2894 } 2895 2896 if (jQuery('.sticky_layout .info-wrapper').length) { 2897 jQuery('.sticky_layout .info-wrapper').each(function() { 2898 jQuery(this).theiaStickySidebar({ 2899 additionalMarginTop: 150, 2900 additionalMarginBottom: 150 2901 }); 2902 }); 2903 } 2904} 2905 2906function wglStripedServicesInit() { 2907 var item_wrap = jQuery('.wgl-striped-services'); 2908 2909 if (item_wrap.length) { 2910 item_wrap.each(function() { 2911 var item = jQuery(this).find('.service-item'); 2912 2913 deviceResize(); 2914 2915 item.on('mouseenter', function(e) { 2916 item_wrap.addClass('onhover'); 2917 item.removeClass('active'); 2918 jQuery(this).addClass('active'); 2919 }); 2920 item.on('mouseleave', function(e) { 2921 item_wrap.removeClass('onhover'); 2922 2923 }); 2924 }); 2925 2926 jQuery( window ).resize( function() { 2927 deviceResize(); 2928 } ); 2929 2930 function deviceResize(){ 2931 var width = jQuery(window).width(); 2932 item_wrap.each(function () { 2933 if(jQuery(this).hasClass('reveal-right-items')){ 2934 if (width > 1024) { 2935 var offset = jQuery(this).offset(); 2936 jQuery(this).css({ 'marginRight': '-' + offset.left + 'px' }); 2937 } else { 2938 jQuery(this).css({ 'marginRight': '0px' }); 2939 } 2940 } 2941 }); 2942 } 2943 } 2944} 2945 2946// Tabs 2947
2948function wglTabsInit() { 2949 let $tabs = jQuery('.wgl-tabs'); 2950 if ($tabs.length) { 2951 $tabs.each(function(){ 2952 let $this = jQuery(this); 2953 let tab = $this.find('.wgl-tabs_headings .wgl-tabs_header'); 2954 let data = $this.find('.wgl-tabs_content-wrap .wgl-tabs_content'); 2955 let $contentWrap = $this.find('.wgl-tabs_content-wrap'); 2956 let height = data.filter('.active').outerHeight(); 2957 2958 if (!tab.hasClass('active')) { 2959 tab.filter(':first').addClass('active'); 2960 data.filter(':first').addClass('active'); 2961 } 2962 2963 data.filter(':not(.active)').hide(); 2964 $contentWrap.css({ 'height': height }); 2965 tab.each(function(){ 2966 let currentTab = jQuery(this); 2967 2968 currentTab.on('click tap', function(){ 2969 let id = currentTab.data('tab-id'); 2970 let currentData = jQuery('.wgl-tabs .wgl-tabs_content[data-tab-id='+id+']'); 2971 height = currentData.outerHeight(); 2972 2973 $contentWrap.css({ 'height': height }); 2974 currentTab.addClass('active').siblings().removeClass('active'); 2975 currentData.addClass('active').slideDown().siblings().removeClass('active').slideUp(); 2976 }); 2977 }); 2978 }) 2979 } 2980} 2981 2982function wglTextBackground() { 2983 var anim_text = jQuery('.wgl-animation-background-text'); 2984 if (anim_text.length) { 2985 anim_text.each(function(index) { 2986 var paralax_text = jQuery('<div class="wgl-background-text"/>'); 2987 2988 jQuery(this) 2989 .find('>div:eq(0)') 2990 .before(paralax_text); 2991 var text = window.getComputedStyle(this, ':before').content; 2992 2993 text = text.slice(1, -1); 2994 2995 paralax_text.addClass('element-' + index); 2996 paralax_text.attr('data-info', index); 2997 2998 jQuery(this) 2999 .find(paralax_text) 3000 .html(text.replace(/([^\x00-\x80]|\w)/g, "<span class='letter'>$&</span>")) 3001 .appear(function() { 3002 if (typeof anime === 'function') { 3003 var item_anime = jQuery(this) 3004 .data('info'); 3005 3006 if (item_anime === index) { 3007 anime.timeline({ loop: false }).add({ 3008 targets: '.element-' + index + ' .letter', 3009 translateY: [100, 0], 3010 translateZ: 0, 3011 opacity: [0, 1], 3012 easing: 'easeOutExpo', 3013 duration: 1400, 3014 delay: function(el, i) { 3015 return 0 + 350 * i; 3016 } 3017 }); 3018 } 3019 } 3020 }); 3021 }); 3022 } 3023} 3024 3025// WGL Time Line Vertical appear 3026function wglInitTimelineAppear() { 3027 3028 var item = jQuery('.wgl-timeline-vertical.appear_animation [class*="tlv__items-"]'); 3029 3030 if (item.length) { 3031 item.each(function() { 3032 var item = jQuery(this); 3033 item.appear(function() { 3034 item.addClass('show'); 3035 }); 3036 }); 3037 } 3038} 3039// WGL Timeline Horizontal 3040 3041function wglTimelineHorizontal() { 3042 let $timeline_horizontal = jQuery('.wgl-timeline-horizontal.appear_anim .time_line_h-items'); 3043 if ($timeline_horizontal.length) { 3044 $timeline_horizontal.appear(function () { 3045 jQuery(this).addClass('show'); 3046 }); 3047 } 3048} 3049function wglWoocommerceHelper(){ 3050 jQuery('body').on('click', '.quantity.number-input span.minus', function(e){ 3051 this.parentNode.querySelector('input[type=number]').stepDown(); 3052 if(document.querySelector('.woocommerce-cart-form [name=update_cart]')){ 3053 document.querySelector('.woocommerce-cart-form [name=update_cart]').disabled = false; 3054 } 3055 });
3056 3057 jQuery('body').on('click', '.quantity.number-input span.plus', function(e){ 3058 this.parentNode.querySelector('input[type=number]').stepUp(); 3059 if(document.querySelector('.woocommerce-cart-form [name=update_cart]')){ 3060 document.querySelector('.woocommerce-cart-form [name=update_cart]').disabled = false; 3061 } 3062 }); 3063 3064 jQuery('.wgl-products .product a.add_to_cart_button.ajax_add_to_cart').on( "click", function() { 3065 jQuery(this).closest('.product').addClass('added_to_cart_item'); 3066 }); 3067} 3068 3069function wglWoocommerceLoginIn() { 3070 var login_in = jQuery('.login-in'); 3071 if (login_in.length) { 3072 var mc = login_in, 3073 icon = mc.find('a.login-in_link'), 3074 overlay = mc.find('div.overlay'); 3075 3076 icon.on('click tap', function(e) { 3077 e.preventDefault(); 3078 mc.toggleClass('open_login'); 3079 }); 3080 3081 var eventClose = function(e) { 3082 if ( 3083 !jQuery(e.target).closest('.modal_content').length && 3084 !jQuery(e.target).is('.modal_content') 3085 ) { 3086 mc.removeClass('open_login'); 3087 } 3088 }; 3089 3090 overlay.on('click tap', eventClose); 3091 3092 jQuery(document).bind('keydown', function(e) { 3093 if (e.which === 27) eventClose(e); 3094 }); 3095 } 3096} 3097function wglWoocommerceMiniCart(){ 3098 var mini_cart = jQuery('header .wgl-cart-header .mini-cart'); 3099 if (mini_cart.length) { 3100 mini_cart.each(function(){ 3101 var overlay = jQuery('div.mini_cart-overlay'), 3102 eventClose = function(e) { 3103 jQuery('.wgl-theme-header').removeClass('open_cart'); 3104 }; 3105 3106 jQuery('a.woo_icon').on('click tap', function() { 3107 jQuery('.wgl-theme-header').toggleClass('open_cart'); 3108 }); 3109 overlay.on('click tap', eventClose); 3110 jQuery('body').on('click', 'header a.close_mini_cart', eventClose); 3111 3112 jQuery(document).bind('keydown', function(e) { 3113 if (e.which === 27) eventClose(e); 3114 }); 3115 }); 3116 } 3117} 3118// Select Wrapper 3119function wglSelectWrap() { 3120 jQuery('select').each(function () { 3121 var $select = jQuery(this); 3122 if ($select.hasClass('first-disable')){ 3123 jQuery('option:first-child', $select).attr('disabled',true); 3124 } 3125 }); 3126} 3127 3128function wglButtonAnimation() { 3129 jQuery('.wgl-button.with-border:not(.load_more_item)').each(function () { 3130 let $_this = jQuery(this); 3131 $_this.on('click tap', function(){ 3132 $_this.addClass('animated'); 3133 setTimeout(function(){ 3134 $_this.removeClass('animated'); 3135 },600) 3136 }); 3137 }); 3138 jQuery('.wgl-button').each(function () { 3139 jQuery(this).on('touchstart mouseenter', function(){ 3140 jQuery(this).find('.highlight_svg').removeClass('hide-highlight').addClass('active') 3141 }).on("touchend mouseleave", function () { 3142 jQuery(this).find('.highlight_svg').addClass('hide-highlight').removeClass('active') 3143 }); 3144 }); 3145}
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.