1function isTouchDevice() { 2 return 'ontouchstart' in window // works on most browsers 3 || 'onmsgesturechange' in window; // works on ie10 4} 5 6function isMobileDevice() { 7 return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1); 8}; 9 10( function( $ ) { 11 // Make sure you run this code under Elementor.. 12 $( window ).on( 'elementor/frontend/init', function() { 13 14 jQuery("img.lazy").each(function() { 15 var currentImg = jQuery(this); 16 17 jQuery(this).Lazy({ 18 onFinishedAll: function() { 19 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 20 currentImg.parent('.tg_gallery_lightbox').parent("div.gallery-grid-item").removeClass("lazy"); 21 } 22 }); 23 }); 24 25 //Apply all entrance animation 26 jQuery('#page-content-wrapper .elementor-widget-image.animation').each(function() { 27 jQuery(this).smoove({ 28 offset : '30%' 29 }); 30 }); 31 32 var bodyBGColor = jQuery('body').css('background-color'); 33 if(bodyBGColor != '') 34 { 35 jQuery('#wrapper').css('background-color', bodyBGColor); 36 } 37 38 //Caculated min height section dynamically for mobile 39 if(parseInt(jQuery(window).width()) < 501) 40 { 41 jQuery("section.elementor-section-height-min-height .elementor-container").each(function() { 42 jQuery(this).height('auto'); 43 }); 44 } 45 46 jQuery(window).resize(function() { 47 jQuery("section.elementor-section-height-min-height .elementor-container").each(function() { 48 var currentSection = jQuery(this); 49 50 if(parseInt(jQuery(window).width()) < 501) 51 { 52 currentSection.height('auto'); 53 } 54 else 55 { 56 currentSection.height(''); 57 } 58 }); 59 }); 60 61 elementorFrontend.hooks.addAction('frontend/element_ready/global', function( $scope ) { 62 63 if(elementorFrontend.isEditMode()) 64 { 65 var elementSettings = {}; 66 var modelCID = $scope.data( 'model-cid' ); 67 68 var settings = elementorFrontend.config.elements.data[ modelCID ]; 69 if(typeof settings != 'undefined') 70 { 71 var type = settings.attributes.widgetType || settings.attributes.elType, 72 settingsKeys = elementorFrontend.config.elements.keys[ type ]; 73 74 if ( ! settingsKeys ) { 75 settingsKeys = elementorFrontend.config.elements.keys[type] = []; 76 77 jQuery.each( settings.controls, function ( name, control ) { 78 if ( control.frontend_available ) { 79 settingsKeys.push( name ); 80 } 81 }); 82 } 83 84 jQuery.each( settings.getActiveControls(), function( controlKey ) { 85 if ( -1 !== settingsKeys.indexOf( controlKey ) ) { 86 elementSettings[ controlKey ] = settings.attributes[ controlKey ]; 87 } 88 } ); 89 90 var widgetExt = elementSettings; 91 } 92 } 93 else 94 { 95 //Get widget settings data 96 var widgetExtObj = $scope.attr('data-settings'); 97 98 if(typeof widgetExtObj != 'undefined') 99 { 100 var widgetExt = JSON.parse(widgetExtObj); 101 } 102 } 103 104 if(typeof widgetExt != 'undefined') 105 { 106 //Begin scroll animation extensions 107 if(typeof widgetExt.avante_ext_is_scrollme != 'undefined' && widgetExt.avante_ext_is_scrollme == 'true') 108 { 109 var scrollArgs = {}; 110 111 if(typeof widgetExt.avante_ext_scrollme_scalex.size != 'undefined' && widgetExt.avante_ext_scrollme_scalex.size != 1) 112 { 113 scrollArgs['scaleX'] = widgetExt.avante_ext_scrollme_scalex.size; 114 } 115 116 if(typeof widgetExt.avante_ext_scrollme_scaley.size != 'undefined' && widgetExt.avante_ext_scrollme_scaley.size != 1) 117 { 118 scrollArgs['scaleY'] = widgetExt.avante_ext_scrollme_scaley.size; 119 } 120 121 if(typeof widgetExt.avante_ext_scrollme_scalez.size != 'undefined' && widgetExt.avante_ext_scrollme_scalez.size != 1) 122 { 123 scrollArgs['scaleZ'] = widgetExt.avante_ext_scrollme_scalez.size; 124 } 125 126 if(typeof widgetExt.avante_ext_scrollme_rotatex.size != 'undefined' && widgetExt.avante_ext_scrollme_rotatex.size != 0) 127 { 128 scrollArgs['rotateX'] = widgetExt.avante_ext_scrollme_rotatex.size; 129 } 130 131 if(typeof widgetExt.avante_ext_scrollme_rotatey.size != 'undefined' && widgetExt.avante_ext_scrollme_rotatey.size != 0) 132 { 133 scrollArgs['rotateY'] = widgetExt.avante_ext_scrollme_rotatey.size; 134 } 135 136 if(typeof widgetExt.avante_ext_scrollme_rotatez.size != 'undefined' && widgetExt.avante_ext_scrollme_rotatez.size != 0) 137 { 138 scrollArgs['rotateY'] = widgetExt.avante_ext_scrollme_rotatez.size; 139 } 140 141 if(typeof widgetExt.avante_ext_scrollme_translatex.size != 'undefined' && widgetExt.avante_ext_scrollme_translatex.size != 0) 142 { 143 scrollArgs['x'] = widgetExt.avante_ext_scrollme_translatex.size; 144 } 145 146 if(typeof widgetExt.avante_ext_scrollme_translatey.size != 'undefined' && widgetExt.avante_ext_scrollme_translatey.size != 0) 147 { 148 scrollArgs['y'] = widgetExt.avante_ext_scrollme_translatey.size; 149 } 150 151 if(typeof widgetExt.avante_ext_scrollme_translatez.size != 'undefined' && widgetExt.avante_ext_scrollme_translatez.size != 0) 152 { 153 scrollArgs['z'] = widgetExt.avante_ext_scrollme_translatez.size; 154 } 155 156 if(typeof widgetExt.avante_ext_scrollme_smoothness.size != 'undefined') 157 { 158 scrollArgs['smoothness'] = widgetExt.avante_ext_scrollme_smoothness.size; 159 } 160 161 //scrollArgs['duration'] = 150; 162 163 $scope.attr('data-parallax', JSON.stringify(scrollArgs)); 164 165 if(typeof widgetExt.avante_ext_scrollme_disable != 'undefined') 166 { 167 if(widgetExt.avante_ext_scrollme_disable == 'mobile') 168 {
169 if(parseInt(jQuery(window).width()) < 501) 170 { 171 $scope.addClass('noanimation'); 172 } 173 } 174 175 if(widgetExt.avante_ext_scrollme_disable == 'tablet') 176 { 177 if(parseInt(jQuery(window).width()) < 769) 178 { 179 $scope.addClass('noanimation'); 180 } 181 } 182 183 jQuery(window).resize(function() { 184 if(widgetExt.avante_ext_scrollme_disable == 'mobile') 185 { 186 if(isMobileDevice() || parseInt(jQuery(window).width()) < 501) 187 { 188 $scope.addClass('noanimation'); 189 } 190 else 191 { 192 $scope.removeClass('noanimation'); 193 } 194 } 195 196 if(widgetExt.avante_ext_scrollme_disable == 'tablet') 197 { 198 if(parseInt(jQuery(window).width()) < 769) 199 { 200 $scope.addClass('noanimation'); 201 } 202 else 203 { 204 $scope.removeClass('noanimation'); 205 } 206 } 207 }); 208 } 209 } 210 //End scroll animation extensions 211 212 //Begin entrance animation extensions 213 if(typeof widgetExt.avante_ext_is_smoove != 'undefined' && widgetExt.avante_ext_is_smoove == 'true') 214 { 215 $scope.addClass('init-smoove'); 216 217 $scope.smoove({ 218 min_width : parseInt(widgetExt.avante_ext_smoove_disable), 219 220 scaleX : widgetExt.avante_ext_smoove_scalex.size, 221 scaleY : widgetExt.avante_ext_smoove_scaley.size, 222 223 rotateX : parseInt(widgetExt.avante_ext_smoove_rotatex.size)+'deg', 224 rotateY : parseInt(widgetExt.avante_ext_smoove_rotatey.size)+'deg', 225 rotateZ : parseInt(widgetExt.avante_ext_smoove_rotatez.size)+'deg', 226 227 moveX : parseInt(widgetExt.avante_ext_smoove_translatex.size)+'px', 228 moveY : parseInt(widgetExt.avante_ext_smoove_translatey.size)+'px', 229 moveZ : parseInt(widgetExt.avante_ext_smoove_translatez.size)+'px', 230 231 skewX : parseInt(widgetExt.avante_ext_smoove_skewx.size)+'deg', 232 skewY : parseInt(widgetExt.avante_ext_smoove_skewy.size)+'deg', 233 234 perspective : parseInt(widgetExt.avante_ext_smoove_perspective.size), 235 236 offset : 0 237 }); 238 239 if(typeof widgetExt.avante_ext_smoove_duration != 'undefined') 240 { 241 $scope.css('transition-duration', parseInt(widgetExt.avante_ext_smoove_duration)+'ms'); 242 } 243 244 var width = jQuery(window).width(); 245 if (widgetExt.avante_ext_smoove_disable >= width) { 246 if(!$scope.hasClass('smooved')) 247 { 248 $scope.addClass('no-smooved'); 249 } 250 251 return false; 252 } 253 } 254 //End entrance animation extensions 255 256 257 //Begin mouse parallax extensions 258 if(typeof widgetExt.avante_ext_is_parallax_mouse != 'undefined' && widgetExt.avante_ext_is_parallax_mouse == 'true') 259 { 260 var elementID = $scope.attr('data-id'); 261 $scope.find('.elementor-widget-container').attr('data-depth', parseFloat(widgetExt.avante_ext_is_parallax_mouse_depth.size)); 262 $scope.attr('ID', 'parallax-'+elementID); 263 264 var parentElement = document.getElementById('parallax-'+elementID); 265 var parallax = new Parallax(parentElement, { 266 relativeInput: true 267 }); 268 269 if(elementorFrontend.isEditMode()) 270 { 271 if($scope.width() == 0) 272 { 273 $scope.css('width', '100%'); 274 } 275 276 if($scope.height() == 0) 277 { 278 $scope.css('height', '100%'); 279 } 280 } 281 } 282 //End mouse parallax extensions 283 284 285 //Begin infinite animation extensions 286 if(typeof widgetExt.avante_ext_is_infinite != 'undefined' && widgetExt.avante_ext_is_infinite == 'true') 287 { 288 var animationClass = ''; 289 var keyframeName = ''; 290 var animationCSS = ''; 291 292 if(typeof widgetExt.avante_ext_infinite_animation != 'undefined') 293 { 294 animationClass = widgetExt.avante_ext_infinite_animation; 295 296 switch(animationClass) { 297 case 'if_swing1': 298 keyframeName = 'swing'; 299 break; 300 301 case 'if_swing2': 302 keyframeName = 'swing2'; 303 break; 304 305 case 'if_wave': 306 keyframeName = 'wave'; 307 break; 308 309 case 'if_tilt': 310 keyframeName = 'tilt'; 311 break; 312 313 case 'if_bounce': 314 keyframeName = 'bounce'; 315 break; 316 317 case 'if_scale': 318 keyframeName = 'scale'; 319 break; 320 321 case 'if_spin': 322 keyframeName = 'spin'; 323 break; 324 } 325 326 animationCSS+= keyframeName+' '; 327 } 328 //alert(widgetExt.avante_ext_infinite_duration); 329 if(typeof widgetExt.avante_ext_infinite_duration != 'undefined') 330 { 331 animationCSS+= widgetExt.avante_ext_infinite_duration+'s '; 332 } 333 334 animationCSS+= 'infinite alternate '; 335 336 if(typeof widgetExt.avante_ext_infinite_easing != 'undefined') 337 { 338 animationCSS+= 'cubic-bezier('+widgetExt.avante_ext_infinite_easing+')'; 339 } 340 //alert(animationCSS); 341 $scope.css({ 342 'animation' : animationCSS, 343 }); 344 $scope.addClass(animationClass); 345 } 346 //End infinite animation extensions 347 } 348 }); 349 350 //Start execute javascript for blog posts 351 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-blog-posts.default', function( $scope ) { 352 jQuery(function( $ ) { 353 jQuery("img.lazy").each(function() { 354 var currentImg = jQuery(this); 355 356 jQuery(this).Lazy({ 357 onFinishedAll: function() { 358 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 359 }, 360 }); 361 }); 362 363 jQuery(".layout-masonry").each(function() { 364 var grid = jQuery(this); 365 366 grid.imagesLoaded().progress( function() { 367 grid.masonry({ 368 itemSelector: ".blog-posts-masonry", 369 columnWidth: ".blog-posts-masonry", 370 gutter : 45 371 }); 372 373 jQuery(".layout-masonry .blog-posts-masonry").each(function(index) { 374 setTimeout(function() { 375 jQuery(".layout-masonry .blog-posts-masonry").eq(index).addClass("is-showing"); 376 }, 250 * index); 377 }); 378 }); 379 380 jQuery(".layout-masonry img.lazy_masonry").each(function() { 381 var currentImg = jQuery(this); 382 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 383 384 jQuery(this).Lazy({ 385 onFinishedAll: function() { 386 grid.masonry({ 387 itemSelector: ".blog-posts-masonry", 388 columnWidth: ".blog-posts-masonry", 389 gutter : 45 390 }); 391 }, 392 }); 393 }); 394 }); 395 396 jQuery(".layout-metro_masonry").each(function() { 397 var grid = jQuery(this); 398 399 grid.imagesLoaded().progress( function() { 400 grid.masonry({ 401 itemSelector: ".blog-posts-metro", 402 columnWidth: ".blog-posts-metro", 403 gutter : 40 404 }); 405 406 jQuery(".layout-metro_masonry .blog-posts-metro").each(function(index) { 407 setTimeout(function() { 408 jQuery(".layout-metro_masonry .blog-posts-metro").eq(index).addClass("is-showing"); 409 }, 100 * index); 410 }); 411 }); 412 413 jQuery(".post-metro-left-wrapper img.lazy_masonry, .layout-metro_masonry img.lazy_masonry").each(function() { 414 var currentImg = jQuery(this); 415 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 416 417 jQuery(this).Lazy({ 418 onFinishedAll: function() { 419 grid.masonry({ 420 itemSelector: ".blog-posts-metro", 421 columnWidth: ".blog-posts-metro", 422 gutter : 40 423 }); 424 }, 425 }); 426 }); 427 }); 428 429 var menuLayout = jQuery('#pp_menu_layout').val();
430 if(menuLayout != 'leftmenu') 431 { 432 jQuery(".post-metro-left-wrapper").stick_in_parent({ offset_top: 120 }); 433 } 434 else 435 { 436 jQuery(".post-metro-left-wrapper").stick_in_parent({ offset_top: 40 }); 437 } 438 439 if(jQuery(window).width() < 768 || isTouchDevice()) 440 { 441 jQuery(".post-metro-left-wrapper").trigger("sticky_kit:detach"); 442 } 443 }); 444 } ); 445 //End execute javascript for blog posts 446 447 //Start execute javascript for gallery grid 448 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-gallery-grid.default', function( $scope ) { 449 jQuery("img.lazy").each(function() { 450 var currentImg = jQuery(this); 451 452 jQuery(this).Lazy({ 453 onFinishedAll: function() { 454 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 455 currentImg.parent('.tg_gallery_lightbox').parent("div.gallery-grid-item").removeClass("lazy"); 456 currentImg.parent("div.gallery-grid-item").removeClass("lazy"); 457 } 458 }); 459 }); 460 } ); 461 //End execute javascript for gallery grid 462 463 //Start execute javascript for gallery masonry 464 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-gallery-masonry.default', function( $scope ) { 465 jQuery(function( $ ) { 466 jQuery(".avante-gallery-grid-content-wrapper.do-masonry").each(function() { 467 var grid = jQuery(this); 468 var cols = grid.attr('data-cols'); 469 470 if(!grid.hasClass('has-no-space')) 471 { 472 var gutter = 30; 473 if(cols > 4) 474 { 475 gutter = 20; 476 } 477 } 478 else 479 { 480 gutter = 0; 481 } 482 483 grid.imagesLoaded().progress( function() { 484 grid.masonry({ 485 itemSelector: ".gallery-grid-item", 486 columnWidth: ".gallery-grid-item", 487 gutter : gutter 488 }); 489 490 jQuery(".avante-gallery-grid-content-wrapper.do-masonry .gallery-grid-item").each(function(index) { 491 setTimeout(function() { 492 jQuery(".do-masonry .gallery-grid-item").eq(index).addClass("is-showing"); 493 }, 100 * index); 494 }); 495 }); 496 497 jQuery(".avante-gallery-grid-content-wrapper.do-masonry img.lazy_masonry").each(function() { 498 var currentImg = jQuery(this); 499 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 500 501 var cols = grid.attr('data-cols'); 502 503 if(!grid.hasClass('has-no-space')) 504 { 505 var gutter = 40; 506 if(cols > 4) 507 { 508 gutter = 30; 509 } 510 } 511 else 512 { 513 gutter = 0; 514 } 515 516 jQuery(this).Lazy({ 517 onFinishedAll: function() { 518 grid.masonry({ 519 itemSelector: ".gallery-grid-item", 520 columnWidth: ".gallery-grid-item", 521 gutter : gutter 522 }); 523 }, 524 }); 525 }); 526 }); 527 }); 528 } ); 529 //End execute javascript for gallery masonry 530 531 //Start execute javascript for gallery justified 532 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-gallery-justified.default', function( $scope ) { 533 jQuery(function( $ ) { 534 jQuery("img.lazy").each(function() { 535 var currentImg = jQuery(this); 536 537 jQuery(this).Lazy({ 538 onFinishedAll: function() { 539 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 540 } 541 }); 542 }); 543 544 jQuery(".avante-gallery-grid-content-wrapper.do-justified").each(function() { 545 var grid = jQuery(this); 546 var rowHeight = grid.attr('data-row_height'); 547 var margin = grid.attr('data-margin'); 548 var justifyLastRow = grid.attr('data-justify_last_row'); 549 var justifyLastRowStr = 'nojustify'; 550 if(justifyLastRow == 'yes') 551 { 552 justifyLastRowStr = 'justify'; 553 } 554 555 grid.imagesLoaded().always( function() { 556 grid.justifiedGallery({ 557 rowHeight: rowHeight, 558 margins: margin, 559 lastRow: justifyLastRowStr 560 }); 561 }); 562 }); 563 }); 564 } ); 565 //End execute javascript for gallery justified 566 567 //Start execute javascript for gallery fullscreen 568 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-gallery-fullscreen.default', function( $scope ) { 569 jQuery(function( $ ) { 570 jQuery('body').addClass('elementor-fullscreen'); 571 572 var slideshow = jQuery('.fullscreen-gallery'); 573 var autoPlay = slideshow.attr('data-autoplay'); 574 var autoPlayArr = false;
575 if (typeof autoPlay != "undefined"){ 576 autoPlayArr = { 577 delay: autoPlay 578 }; 579 } 580 581 var effect = slideshow.attr('data-effect'); 582 if (typeof effect == "undefined"){ 583 effect = 'slide'; 584 } 585 586 var speed = slideshow.attr('data-speed'); 587 if (typeof speed == "undefined"){ 588 speed = 400; 589 } 590 591 var galleryTop = new Swiper('.fullscreen-gallery', { 592 navigation: { 593 nextEl: '.swiper-button-next', 594 prevEl: '.swiper-button-prev', 595 }, 596 spaceBetween: 0, 597 keyboardControl: true, 598 speed: parseInt(speed), 599 loop: true, 600 effect: effect, 601 grabCursor: true, 602 preloadImages: false, 603 lazy: { 604 loadPrevNext: true, 605 }, 606 autoplay: autoPlayArr 607 }); 608 }); 609 } ); 610 //End execute javascript for gallery fullscreen 611 612 //Start execute javascript for vertical parallax 613 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-vertical-parallax.default', function( $scope ) { 614 jQuery(function( $ ) { 615 jQuery('body').addClass('elementor-fullscreen'); 616 617 var ticking = false; 618 var isFirefox = /Firefox/i.test(navigator.userAgent); 619 var isIe = /MSIE/i.test(navigator.userAgent) || /Trident.*rv\:11\./i.test(navigator.userAgent); 620 var scrollSensitivitySetting = 30; 621 var slideDurationSetting =800; 622 var currentSlideNumber = 0; 623 var totalSlideNumber = jQuery('.parallax-slide-background').length; 624 function parallaxScroll(evt) { 625 if (isFirefox) { 626 delta = evt.detail * -120; 627 } else if (isIe) { 628 delta = -evt.deltaY; 629 } else { 630 delta = evt.wheelDelta; 631 } 632 if (ticking != true) { 633 if (delta <= -scrollSensitivitySetting) { 634 ticking = true; 635 if (currentSlideNumber !== totalSlideNumber - 1) { 636 currentSlideNumber++; 637 nextItem(); 638 } 639 slideDurationTimeout(slideDurationSetting); 640 } 641 if (delta >= scrollSensitivitySetting) { 642 ticking = true; 643 if (currentSlideNumber !== 0) { 644 currentSlideNumber--; 645 } 646 previousItem(); 647 slideDurationTimeout(slideDurationSetting); 648 } 649 } 650 } 651 function slideDurationTimeout(slideDuration) { 652 setTimeout(function () { 653 ticking = false; 654 }, slideDuration); 655 } 656 657 var mousewheelEvent = isFirefox ? 'DOMMouseScroll' : 'wheel'; 658 window.addEventListener(mousewheelEvent, parallaxScroll, false); 659 function nextItem() { 660 var $previousSlide = jQuery('.parallax-slide-background').eq(currentSlideNumber - 1); 661 $previousSlide.css('transform', 'translate3d(0,-130vh,0)').find('.parallax-slide-content-wrapper').css('transform', 'translateY(40vh)'); 662 currentSlideTransition(); 663 } 664 function previousItem() { 665 var $previousSlide = jQuery('.parallax-slide-background').eq(currentSlideNumber + 1); 666 $previousSlide.css('transform', 'translate3d(0,30vh,0)').find('.parallax-slide-content-wrapper').css('transform', 'translateY(30vh)'); 667 currentSlideTransition(); 668 } 669 function currentSlideTransition() { 670 var $currentSlide = jQuery('.parallax-slide-background').eq(currentSlideNumber); 671 $currentSlide.css('transform', 'translate3d(0,-15vh,0)').find('.parallax-slide-content-wrapper').css('transform', 'translateY(15vh)'); 672 ; 673 } 674 675 jQuery('body').on('touchmove', function(e){ 676 e.preventDefault(); 677 e.stopPropagation(); 678 679 return false; 680 }); 681 682 var ts; 683 jQuery(document).bind('touchstart', function (e){ 684 ts = e.originalEvent.touches[0].clientY; 685 }); 686 687 jQuery(document).bind('touchend', function (e){ 688 var te = e.originalEvent.changedTouches[0].clientY; 689 if(ts > te+5){ 690 if (currentSlideNumber !== totalSlideNumber - 1) { 691 currentSlideNumber++; 692 nextItem(); 693 } 694 slideDurationTimeout(slideDurationSetting); 695 }else if(ts < te-5){ 696 if (currentSlideNumber !== 0) { 697 currentSlideNumber--; 698 } 699 previousItem(); 700 slideDurationTimeout(slideDurationSetting); 701 } 702 }); 703 }); 704 } ); 705 //End execute javascript for gallery vertical parallax 706 707 //Start execute javascript for gallery horizontal 708 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-gallery-horizontal.default', function( $scope ) { 709 jQuery('body').addClass('gallery-horizontal'); 710 711 jQuery(".horizontal-gallery-wrapper").each(function() { 712 var $carousel = jQuery(this); 713 var timer = $carousel.attr('data-autoplay'); 714 if(timer == 0) 715 { 716 timer = false;
717 } 718 719 var loop = $carousel.attr('data-loop'); 720 var navigation = $carousel.attr('data-navigation'); 721 if(navigation == 0) 722 { 723 navigation = false; 724 } 725 726 var pagination = $carousel.attr('data-pagination'); 727 if(pagination == 0) 728 { 729 pagination = false; 730 } 731 732 $carousel.flickity({ 733 percentPosition: false, 734 imagesLoaded: true, 735 selectedAttraction: 0.01, 736 friction: 0.2, 737 lazyLoad: 5, 738 pauseAutoPlayOnHover: true, 739 autoPlay: timer, 740 contain: true, 741 prevNextButtons: navigation, 742 pageDots: pagination 743 }); 744 745 var parallax = $carousel.attr('data-parallax'); 746 if(parallax == 1) 747 { 748 var $imgs = $carousel.find('.horizontal-gallery-cell img'); 749 750 var docStyle = document.documentElement.style; 751 var transformProp = typeof docStyle.transform == 'string' ? 752 'transform' : 'WebkitTransform'; 753 754 var flkty = $carousel.data('flickity'); 755 756 $carousel.on( 'scroll.flickity', function() { 757 flkty.slides.forEach( function( slide, i ) { 758 var img = $imgs[i]; 759 var x = ( slide.target + flkty.x ) * -1/3; 760 img.style[ transformProp ] = 'translateX(' + x + 'px)'; 761 }); 762 }); 763 } 764 765 var fullscreen = $carousel.attr('data-fullscreen'); 766 if(fullscreen != 0) 767 { 768 jQuery('body').addClass('elementor-fullscreen'); 769 770 //Get menu element height 771 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 772 var documentHeight = jQuery(window).innerHeight(); 773 var sliderHeight = parseInt(documentHeight - menuHeight); 774 775 $carousel.find('.horizontal-gallery-cell').css('height', sliderHeight+'px'); 776 $carousel.find('.horizontal-gallery-cell-img').css('height', sliderHeight+'px'); 777 $carousel.flickity('resize'); 778 779 jQuery( window ).resize(function() { 780 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 781 var documentHeight = jQuery(window).innerHeight(); 782 var sliderHeight = parseInt(documentHeight - menuHeight); 783 784 $carousel.find('.horizontal-gallery-cell').css('height', sliderHeight+'px'); 785 $carousel.find('.horizontal-gallery-cell-img').css('height', sliderHeight+'px'); 786 $carousel.flickity('resize'); 787 }); 788 } 789 }); 790 } ); 791 //End execute javascript for gallery horizontal 792 793 //Start execute javascript for slider horizontal 794 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-horizontal.default', function( $scope ) { 795 jQuery(".horizontal-slider-wrapper").each(function() { 796 var $carousel = jQuery(this); 797 var timer = $carousel.attr('data-autoplay'); 798 if(timer == 0) 799 { 800 timer = false; 801 } 802 803 var loop = $carousel.attr('data-loop'); 804 var navigation = $carousel.attr('data-navigation'); 805 if(navigation == 0) 806 { 807 navigation = false; 808 } 809 810 var pagination = $carousel.attr('data-pagination'); 811 if(pagination == 0) 812 { 813 pagination = false; 814 } 815 816 $carousel.flickity({ 817 percentPosition: false, 818 imagesLoaded: true, 819 pauseAutoPlayOnHover: true, 820 autoPlay: parseInt(timer), 821 contain: true, 822 prevNextButtons: navigation, 823 pageDots: pagination 824 }); 825 826 var fullscreen = $carousel.attr('data-fullscreen'); 827 if(fullscreen != 0) 828 { 829 jQuery('body').addClass('elementor-fullscreen'); 830 831 //Get menu element height 832 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 833 var documentHeight = jQuery(window).innerHeight(); 834 var sliderHeight = parseInt(documentHeight - menuHeight); 835 836 $carousel.find('.horizontal-slider-cell').css('height', sliderHeight+'px'); 837 $carousel.flickity('resize'); 838 839 jQuery( window ).resize(function() { 840 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 841 var documentHeight = jQuery(window).innerHeight(); 842 var sliderHeight = parseInt(documentHeight - menuHeight); 843 844 $carousel.find('.horizontal-slider-cell').css('height', sliderHeight+'px'); 845 $carousel.flickity('resize'); 846 }); 847 } 848 }); 849 } ); 850 //End execute javascript for slider horizontal 851 852 //Start execute javascript for slider animated frame 853 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-animated-frame.default', function( $scope ) { 854 function debounce(func, wait, immediate) { 855 var timeout; 856 return function() { 857 var context = this, args = arguments; 858 var later = function() { 859 timeout = null;
860 if (!immediate) func.apply(context, args); 861 }; 862 var callNow = immediate && !timeout; 863 clearTimeout(timeout); 864 timeout = setTimeout(later, wait); 865 if (callNow) func.apply(context, args); 866 }; 867 }; 868 869 class Slideshow { 870 constructor(el) { 871 this.DOM = {}; 872 this.DOM.el = el; 873 this.settings = { 874 animation: { 875 slides: { 876 duration: 600, 877 easing: 'easeOutQuint' 878 }, 879 shape: { 880 duration: 300, 881 easing: {in: 'easeOutQuint', out: 'easeOutQuad'} 882 } 883 }, 884 frameFill: slideshowFrameColor 885 } 886 this.init(); 887 } 888 init() { 889 if(this.DOM.el) 890 { 891 this.DOM.slides = Array.from(this.DOM.el.querySelectorAll('.slides > .slide')); 892 this.slidesTotal = this.DOM.slides.length; 893 this.DOM.nav = this.DOM.el.querySelector('.slidenav'); 894 this.DOM.nextCtrl = this.DOM.nav.querySelector('.slidenav-item--next'); 895 this.DOM.prevCtrl = this.DOM.nav.querySelector('.slidenav-item--prev'); 896 this.current = 0; 897 this.createFrame(); 898 this.initEvents(); 899 } 900 } 901 createFrame() { 902 this.rect = this.DOM.el.getBoundingClientRect(); 903 this.frameSize = this.rect.width/12; 904 this.paths = { 905 initial: this.calculatePath('initial'), 906 final: this.calculatePath('final') 907 }; 908 this.DOM.svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); 909 this.DOM.svg.setAttribute('class', 'shape'); 910 this.DOM.svg.setAttribute('width','100%'); 911 this.DOM.svg.setAttribute('height','100%'); 912 this.DOM.svg.setAttribute('viewbox',`0 0 ${this.rect.width} ${this.rect.height}`); 913 this.DOM.svg.innerHTML = `<path fill="${this.settings.frameFill}" d="${this.paths.initial}"/>`; 914 this.DOM.el.insertBefore(this.DOM.svg, this.DOM.nav); 915 this.DOM.shape = this.DOM.svg.querySelector('path'); 916 } 917 updateFrame() { 918 this.paths.initial = this.calculatePath('initial'); 919 this.paths.final = this.calculatePath('final'); 920 this.DOM.svg.setAttribute('viewbox',`0 0 ${this.rect.width} ${this.rect.height}`); 921 this.DOM.shape.setAttribute('d', this.isAnimating ? this.paths.final : this.paths.initial); 922 } 923 calculatePath(path = 'initial') { 924 return path === 'initial' ? 925 `M 0,0 0,${this.rect.height} ${this.rect.width},${this.rect.height} ${this.rect.width},0 0,0 Z M 0,0 ${this.rect.width},0 ${this.rect.width},${this.rect.height} 0,${this.rect.height} Z` : 926 `M 0,0 0,${this.rect.height} ${this.rect.width},${this.rect.height} ${this.rect.width},0 0,0 Z M ${this.frameSize},${this.frameSize} ${this.rect.width-this.frameSize},${this.frameSize} ${this.rect.width-this.frameSize},${this.rect.height-this.frameSize} ${this.frameSize},${this.rect.height-this.frameSize} Z`; 927 } 928 initEvents() { 929 this.DOM.nextCtrl.addEventListener('click', () => this.navigate('next')); 930 this.DOM.prevCtrl.addEventListener('click', () => this.navigate('prev')); 931 932 window.addEventListener('resize', debounce(() => { 933 this.rect = this.DOM.el.getBoundingClientRect(); 934 this.updateFrame(); 935 }, 20)); 936 937 document.addEventListener('keydown', (ev) => { 938 const keyCode = ev.keyCode || ev.which; 939 if ( keyCode === 37 ) { 940 this.navigate('prev'); 941 } 942 else if ( keyCode === 39 ) { 943 this.navigate('next'); 944 } 945 }); 946 } 947 navigate(dir = 'next') { 948 if ( this.isAnimating ) return false;
949 this.isAnimating = true; 950 951 const animateShapeIn = anime({ 952 targets: this.DOM.shape, 953 duration: this.settings.animation.shape.duration, 954 easing: this.settings.animation.shape.easing.in, 955 d: this.paths.final 956 }); 957 958 const animateSlides = () => { 959 return new Promise((resolve, reject) => { 960 const currentSlide = this.DOM.slides[this.current]; 961 anime({ 962 targets: currentSlide, 963 duration: this.settings.animation.slides.duration, 964 easing: this.settings.animation.slides.easing, 965 translateX: dir === 'next' ? -1*this.rect.width : this.rect.width, 966 complete: () => { 967 currentSlide.classList.remove('slide-current'); 968 resolve(); 969 } 970 }); 971 972 this.current = dir === 'next' ? 973 this.current < this.slidesTotal-1 ? this.current + 1 : 0 : 974 this.current > 0 ? this.current - 1 : this.slidesTotal-1; 975 976 const newSlide = this.DOM.slides[this.current]; 977 newSlide.classList.add('slide-current'); 978 anime({ 979 targets: newSlide, 980 duration: this.settings.animation.slides.duration, 981 easing: this.settings.animation.slides.easing, 982 translateX: [dir === 'next' ? this.rect.width : -1*this.rect.width,0] 983 }); 984 985 const newSlideImg = newSlide.querySelector('.slide-img'); 986 anime.remove(newSlideImg); 987 anime({ 988 targets: newSlideImg, 989 duration: this.settings.animation.slides.duration*4, 990 easing: this.settings.animation.slides.easing, 991 translateX: [dir === 'next' ? 200 : -200, 0] 992 }); 993 994 anime({ 995 targets: [newSlide.querySelector('.slide-title'), newSlide.querySelector('.slide-desc'), newSlide.querySelector('.slide-link')], 996 duration: this.settings.animation.slides.duration*2, 997 easing: this.settings.animation.slides.easing, 998 delay: (t,i) => i*100+100, 999 translateX: [dir === 'next' ? 300 : -300,0], 1000 opacity: [0,1] 1001 }); 1002 }); 1003 }; 1004 1005 const animateShapeOut = () => { 1006 anime({ 1007 targets: this.DOM.shape, 1008 duration: this.settings.animation.shape.duration, 1009 delay: 150, 1010 easing: this.settings.animation.shape.easing.out, 1011 d: this.paths.initial, 1012 complete: () => this.isAnimating = false 1013 }); 1014 } 1015 1016 animateShapeIn.finished.then(animateSlides).then(animateShapeOut); 1017 } 1018 }; 1019 1020 var slideshow = document.querySelector('.slideshow'); 1021 if(slideshow) 1022 { 1023 var slideshowFrameColor = slideshow.getAttribute('data-background'); 1024 new Slideshow(slideshow); 1025 imagesLoaded('.slide-img', { background: true }); 1026 } 1027 } ); 1028 //End execute javascript for slider animated frame 1029 1030 //Start execute javascript for slider 3d room 1031 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-room.default', function( $scope ) { 1032 jQuery('body').addClass('elementor-fullscreen'); 1033 jQuery('body').addClass('room'); 1034 1035 function debounce(func, wait, immediate) { 1036 var timeout; 1037 return function() { 1038 var context = this, args = arguments; 1039 var later = function() { 1040 timeout = null;
1041 if (!immediate) func.apply(context, args); 1042 }; 1043 var callNow = immediate && !timeout; 1044 clearTimeout(timeout); 1045 timeout = setTimeout(later, wait); 1046 if (callNow) func.apply(context, args); 1047 }; 1048 }; 1049 1050 function getMousePos(e) { 1051 var posx = 0; 1052 var posy = 0; 1053 if (!e) var e = window.event; 1054 if (e.pageX || e.pageY) { 1055 posx = e.pageX; 1056 posy = e.pageY; 1057 } 1058 else if (e.clientX || e.clientY) { 1059 posx = e.clientX + document.body.scrollLeft 1060 + document.documentElement.scrollLeft; 1061 posy = e.clientY + document.body.scrollTop 1062 + document.documentElement.scrollTop; 1063 } 1064 return { 1065 x : posx, 1066 y : posy 1067 } 1068 } 1069 1070 var DOM = {}; 1071 // The loader. 1072 DOM.loader = document.querySelector('.room-slider-wrapper .overlay--loader'); 1073 // The room wrapper. This will be the element to be transformed in order to move around. 1074 DOM.scroller = document.querySelector('.room-slider-wrapper .container > .scroller'); 1075 // The rooms. 1076 if (DOM.scroller) 1077 { 1078 DOM.rooms = [].slice.call(DOM.scroller.querySelectorAll('.room')); 1079 } 1080 else 1081 { 1082 DOM.rooms = {}; 1083 } 1084 1085 // The content wrapper. 1086 DOM.content = document.querySelector('.room-slider-wrapper .content'); 1087 if (DOM.content) 1088 { 1089 // Rooms navigation controls. 1090 DOM.nav = { 1091 leftCtrl : DOM.content.querySelector('.room-slider-wrapper nav > .btn--nav-left'), 1092 rightCtrl : DOM.content.querySelector('.room-slider-wrapper nav > .btn--nav-right') 1093 }; 1094 // Content slides. 1095 DOM.slides = [].slice.call(DOM.content.querySelectorAll('.slides > .slide')); 1096 } 1097 1098 var currentRoom = 0, 1099 // Total number of rooms. 1100 totalRooms = DOM.rooms.length, 1101 // Initial transform. 1102 initTransform = { translateX : 0, translateY : 0, translateZ : '500px', rotateX : 0, rotateY : 0, rotateZ : 0 }, 1103 // Reset transform. 1104 resetTransform = { translateX : 0, translateY : 0, translateZ : 0, rotateX : 0, rotateY : 0, rotateZ : 0 }, 1105 // View from top. 1106 menuTransform = { translateX : 0, translateY : '150%', translateZ : 0, rotateX : '15deg', rotateY : 0, rotateZ : 0 }, 1107 menuTransform = { translateX : 0, translateY : '50%', translateZ : 0, rotateX : '-10deg', rotateY : 0, rotateZ : 0 }, 1108 // Info view transform. 1109 infoTransform = { translateX : 0, translateY : 0, translateZ : '200px', rotateX : '2deg', rotateY : 0, rotateZ : '4deg' }, 1110 // Room initial moving transition. 1111 initTransition = { speed: '0.9s', easing: 'ease' }, 1112 // Room moving transition. 1113 roomTransition = { speed: '0.4s', easing: 'ease' }, 1114 // View from top transition. 1115 menuTransition = { speed: '1.5s', easing: 'cubic-bezier(0.2,1,0.3,1)' }, 1116 // Info transition. 1117 infoTransition = { speed: '15s', easing: 'cubic-bezier(0.3,1,0.3,1)' }, 1118 // Tilt transition 1119 tiltTransition = { speed: '0.2s', easing: 'ease-out' }, 1120 tilt = false, 1121 // How much to rotate when the mouse moves. 1122 tiltRotation = { 1123 rotateX : 1, // a relative rotation of -1deg to 1deg on the x-axis 1124 rotateY : -3 // a relative rotation of -3deg to 3deg on the y-axis 1125 }, 1126 // Transition end event handler. 1127 onEndTransition = function(el, callback) { 1128 var onEndCallbackFn = function(ev) { 1129 this.removeEventListener('transitionend', onEndCallbackFn); 1130 if( callback && typeof callback === 'function' ) { callback.call(); } 1131 }; 1132 el.addEventListener('transitionend', onEndCallbackFn); 1133 },
1134 // Window sizes. 1135 win = {width: window.innerWidth, height: window.innerHeight}, 1136 // Check if moving inside the room and check if navigating. 1137 isMoving, isNavigating; 1138 1139 function init() { 1140 // Move into the current room. 1141 move({transition: initTransition, transform: initTransform}).then(function() { 1142 initTilt(); 1143 }); 1144 // Animate the current slide in. 1145 showSlide(100); 1146 // Init/Bind events. 1147 initEvents(); 1148 } 1149 1150 function initTilt() { 1151 applyRoomTransition(tiltTransition); 1152 tilt = true; 1153 } 1154 1155 function removeTilt() { 1156 tilt = false; 1157 } 1158 1159 function move(opts) { 1160 return new Promise(function(resolve, reject) { 1161 if( isMoving && !opts.stopTransition ) { 1162 return false; 1163 } 1164 isMoving = true; 1165 1166 if( opts.transition ) { 1167 applyRoomTransition(opts.transition); 1168 } 1169 1170 if( opts.transform ) { 1171 applyRoomTransform(opts.transform); 1172 var onEndFn = function() { 1173 isMoving = false; 1174 resolve(); 1175 }; 1176 onEndTransition(DOM.scroller, onEndFn); 1177 } 1178 else { 1179 resolve(); 1180 } 1181 1182 }); 1183 } 1184 1185 function initEvents() { 1186 // Mousemove event / Tilt functionality. 1187 var onMouseMoveFn = function(ev) { 1188 requestAnimationFrame(function() { 1189 if( !tilt ) return false; 1190 1191 1192 var mousepos = getMousePos(ev), 1193 // transform values 1194 rotX = tiltRotation.rotateX ? initTransform.rotateX - (2 * tiltRotation.rotateX / win.height * mousepos.y - tiltRotation.rotateX) : 0, 1195 rotY = tiltRotation.rotateY ? initTransform.rotateY - (2 * tiltRotation.rotateY / win.width * mousepos.x - tiltRotation.rotateY) : 0; 1196 1197 // apply transform 1198 applyRoomTransform({ 1199 'translateX' : initTransform.translateX, 1200 'translateY' : initTransform.translateY, 1201 'translateZ' : initTransform.translateZ, 1202 'rotateX' : rotX + 'deg', 1203 'rotateY' : rotY + 'deg', 1204 'rotateZ' : initTransform.rotateZ 1205 }); 1206 }); 1207 }, 1208 // Window resize. 1209 debounceResizeFn = debounce(function() { 1210 win = {width: window.innerWidth, height: window.innerHeight}; 1211 }, 10); 1212 1213 document.addEventListener('mousemove', onMouseMoveFn); 1214 window.addEventListener('resize', debounceResizeFn); 1215 1216 // Room navigation. 1217 var onNavigatePrevFn = function() { navigate('prev'); }, 1218 onNavigateNextFn = function() { navigate('next'); }; 1219 1220 if(DOM.nav.leftCtrl && DOM.nav.rightCtrl) 1221 { 1222 DOM.nav.leftCtrl.addEventListener('click', onNavigatePrevFn); 1223 DOM.nav.rightCtrl.addEventListener('click', onNavigateNextFn); 1224 } 1225 } 1226 1227 function applyRoomTransform(transform) { 1228 DOM.scroller.style.transform = 'translate3d(' + transform.translateX + ', ' + transform.translateY + ', ' + transform.translateZ + ') ' + 1229 'rotate3d(1,0,0,' + transform.rotateX + ') rotate3d(0,1,0,' + transform.rotateY + ') rotate3d(0,0,1,' + transform.rotateZ + ')'; 1230 } 1231 1232 function applyRoomTransition(transition) { 1233 DOM.scroller.style.transition = transition === 'none' ? transition : 'transform ' + transition.speed + ' ' + transition.easing; 1234 } 1235 1236 function toggleSlide(dir, delay) { 1237 var slide = DOM.slides[currentRoom], 1238 // Slide's name. 1239 name = slide.querySelector('.slide-name'), 1240 // Slide's title and date elements. 1241 title = slide.querySelector('.slide-title'), 1242 date = slide.querySelector('.slide-date'); 1243 1244 delay = delay !== undefined ? delay : 0; 1245 1246 anime.remove([name, title, date]); 1247 var animeOpts = { 1248 targets: [name, title, date], 1249 duration: dir === 'in' ? 400 : 400, 1250 //delay: 0,//dir === 'in' ? 150 : 0, 1251 delay: function(t, i, c) { 1252 return delay + 75+i*75; 1253 }, 1254 easing: [0.25,0.1,0.25,1], 1255 opacity: { 1256 value: dir === 'in' ? [0,1] : [1,0], 1257 duration: dir === 'in' ? 550 : 250 1258 }, 1259 translateY: function(t, i) { 1260 return dir === 'in' ? [150,0] : [0,-150]; 1261 } 1262 }; 1263 if( dir === 'in' ) { 1264 animeOpts.begin = function() { 1265 slide.classList.add('slide-current'); 1266 }; 1267 } 1268 else { 1269 animeOpts.complete = function() { 1270 slide.classList.remove('slide-current'); 1271 }; 1272 } 1273 anime(animeOpts); 1274 } 1275 1276 function showSlide(delay) { 1277 toggleSlide('in', delay); 1278 } 1279 1280 function hideSlide(delay) { 1281 toggleSlide('out', delay); 1282 } 1283 1284 function navigate(dir) { 1285 if( isMoving || isNavigating ) { 1286 return false;
1287 } 1288 isNavigating = true; 1289 1290 var room = DOM.rooms[currentRoom]; 1291 1292 // Remove tilt. 1293 removeTilt(); 1294 // Animate the current slide out - animate the name, title and date elements. 1295 hideSlide(); 1296 1297 // Update currentRoom. 1298 if( dir === 'next' ) { 1299 currentRoom = currentRoom < totalRooms - 1 ? currentRoom + 1 : 0; 1300 } 1301 else { 1302 currentRoom = currentRoom > 0 ? currentRoom - 1 : totalRooms - 1; 1303 } 1304 1305 // Position the next room. 1306 var nextRoom = DOM.rooms[currentRoom]; 1307 nextRoom.style.transform = 'translate3d(' + (dir === 'next' ? 100 : -100) + '%,0,0) translate3d(' + (dir === 'next' ? 1 : -1) + 'px,0,0)' ; 1308 nextRoom.style.opacity = 1; 1309 1310 // Move back. 1311 move({transition: roomTransition, transform: resetTransform}) 1312 .then(function() { 1313 // Move left or right. 1314 return move({transform: { translateX : (dir === 'next' ? -100 : 100) + '%', translateY : 0, translateZ : 0, rotateX : 0, rotateY : 0, rotateZ : 0 }}); 1315 }) 1316 .then(function() { 1317 // Update current room class. 1318 nextRoom.classList.add('room--current'); 1319 room.classList.remove('room--current'); 1320 room.style.opacity = 0; 1321 1322 // Show the next slide. 1323 showSlide(); 1324 1325 // Move into room. 1326 // Update final transform state: 1327 return move({transform: { translateX : (dir === 'next' ? -100 : 100) + '%', translateY : 0, translateZ : '500px', rotateX : 0, rotateY : 0, rotateZ : 0 }}); 1328 }) 1329 .then(function() { 1330 // Reset positions. 1331 applyRoomTransition('none'); 1332 nextRoom.style.transform = 'translate3d(0,0,0)'; 1333 applyRoomTransform(initTransform); 1334 1335 setTimeout(function() { 1336 initTilt(); 1337 }, 60); 1338 isNavigating = false; 1339 }); 1340 } 1341 1342 function addAdjacentRooms() { 1343 // Current room. 1344 var room = DOM.rooms[currentRoom], 1345 // Adjacent rooms. 1346 nextRoom = DOM.rooms[currentRoom < totalRooms - 1 ? currentRoom + 1 : 0], 1347 prevRoom = DOM.rooms[currentRoom > 0 ? currentRoom - 1 : totalRooms - 1]; 1348 1349 // Position the adjacent rooms. 1350 nextRoom.style.transform = 'translate3d(100%,0,0) translate3d(3px,0,0)'; 1351 nextRoom.style.opacity = 1; 1352 prevRoom.style.transform = 'translate3d(-100%,0,0) translate3d(-3px,0,0)'; 1353 prevRoom.style.opacity = 1; 1354 } 1355 1356 function removeAdjacentRooms() { 1357 // Current room. 1358 var room = DOM.rooms[currentRoom], 1359 // Adjacent rooms. 1360 nextRoom = DOM.rooms[currentRoom < totalRooms - 1 ? currentRoom + 1 : 0], 1361 prevRoom = DOM.rooms[currentRoom > 0 ? currentRoom - 1 : totalRooms - 1]; 1362 1363 // Position the adjacent rooms. 1364 nextRoom.style.transform = 'none'; 1365 nextRoom.style.opacity = 0; 1366 prevRoom.style.transform = 'none'; 1367 prevRoom.style.opacity = 0; 1368 } 1369 1370 // Preload all the images. 1371 if(DOM.scroller) 1372 { 1373 imagesLoaded(DOM.scroller, function() { 1374 var extradelay = 1000; 1375 // Slide out loader. 1376 anime({ 1377 targets: DOM.loader, 1378 duration: 600, 1379 easing: 'easeInOutCubic', 1380 delay: extradelay, 1381 translateY: '-100%', 1382 begin: function() { 1383 init(); 1384 }, 1385 complete: function() { 1386 DOM.loader.classList.remove('overlay--active'); 1387 } 1388 }); 1389 }); 1390 } 1391 } ); 1392 //End execute javascript for slider 3d room 1393 1394 1395 //Start execute javascript for slider multi layouts 1396 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-multi-layouts.default', function( $scope ) { 1397 document.documentElement.className = 'js'; 1398 1399 var slideshow = new MLSlideshow(document.querySelector('.slideshow')); 1400 1401 if(document.querySelector('#next-slide')) 1402 { 1403 document.querySelector('#next-slide').addEventListener('click', function() { 1404 slideshow.next(); 1405 }); 1406 } 1407 1408 if(document.querySelector('#prev-slide')) 1409 { 1410 document.querySelector('#prev-slide').addEventListener('click', function() { 1411 slideshow.prev(); 1412 }); 1413 } 1414 } ); 1415 //End execute javascript for slider multi layouts 1416 1417 //Start execute javascript for slider velo 1418 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-velo.default', function( $scope ) { 1419 jQuery('body').addClass('elementor-fullscreen'); 1420 1421 /** 1422 * Velocity Effects 1423 * 1424 * First, A few Registered effects for velocity's ui kit. 1425 * Actual slider stuff below 1426 */ 1427 1428 var scaleDownAmnt = 0.7;
1429 var boxShadowAmnt = '40px'; 1430 1431 $.Velocity.RegisterEffect("translateUp", { 1432 defaultDuration: 1, 1433 calls: [ 1434 [{ 1435 translateY: '-100%' 1436 }, 1] 1437 ] 1438 }); 1439 $.Velocity.RegisterEffect("translateDown", { 1440 defaultDuration: 1, 1441 calls: [ 1442 [{ 1443 translateY: '100%' 1444 }, 1] 1445 ] 1446 }); 1447 $.Velocity.RegisterEffect("translateNone", { 1448 defaultDuration: 1, 1449 calls: [ 1450 [{ 1451 translateY: '0', 1452 opacity: '1', 1453 scale: '1', 1454 1455 }, 1] 1456 ] 1457 }); 1458 //scale down 1459 $.Velocity.RegisterEffect("scaleDown", { 1460 defaultDuration: 1, 1461 calls: [ 1462 [{ 1463 opacity: '0', 1464 scale: '0.7', 1465 1466 }, 1] 1467 ] 1468 }); 1469 1470 //gallery 1471 $.Velocity.RegisterEffect("scaleDown.moveUp", { 1472 defaultDuration: 1, 1473 calls: [ 1474 [{ 1475 translateY: '0%', 1476 scale: scaleDownAmnt, 1477 1478 }, 0.20], 1479 [{ 1480 translateY: '-100%' 1481 }, 0.60], 1482 [{ 1483 translateY: '-100%', 1484 scale: '1', 1485 // boxShadowBlur: '0' 1486 }, 0.20] 1487 ] 1488 }); 1489 $.Velocity.RegisterEffect("scaleDown.moveUp.scroll", { 1490 defaultDuration: 1, 1491 calls: [ 1492 [{ 1493 translateY: '-100%', 1494 scale: scaleDownAmnt, 1495 1496 }, 0.60], 1497 [{ 1498 translateY: '-100%', 1499 scale: '1', 1500 // boxShadowBlur: '0' 1501 }, 0.40] 1502 ] 1503 }); 1504 $.Velocity.RegisterEffect("scaleUp.moveUp", { 1505 defaultDuration: 1, 1506 calls: [ 1507 [{ 1508 translateY: '90%', 1509 scale: scaleDownAmnt, 1510 // boxShadowBlur: boxShadowAmnt 1511 }, 0.20], 1512 [{ 1513 translateY: '0%' 1514 }, 0.60], 1515 [{ 1516 translateY: '0%', 1517 scale: '1', 1518 // boxShadowBlur: '0' 1519 }, 0.20] 1520 ] 1521 }); 1522 $.Velocity.RegisterEffect("scaleUp.moveUp.scroll", { 1523 defaultDuration: 1, 1524 calls: [ 1525 [{ 1526 translateY: '0%', 1527 scale: scaleDownAmnt, 1528 // boxShadowBlur: boxShadowAmnt 1529 }, 0.60], 1530 [{ 1531 translateY: '0%', 1532 scale: '1', 1533 // boxShadowBlur: '0' 1534 }, 0.40] 1535 ] 1536 }); 1537 $.Velocity.RegisterEffect("scaleDown.moveDown", { 1538 defaultDuration: 1, 1539 calls: [ 1540 [{ 1541 translateY: '0%', 1542 scale: scaleDownAmnt, 1543 // boxShadowBlur: boxShadowAmnt 1544 }, 0.20], 1545 [{ 1546 translateY: '100%' 1547 }, 0.60], 1548 [{ 1549 translateY: '100%', 1550 scale: '1', 1551 // boxShadowBlur: '0' 1552 }, 0.20] 1553 ] 1554 }); 1555 $.Velocity.RegisterEffect("scaleDown.moveDown.scroll", { 1556 defaultDuration: 1, 1557 calls: [ 1558 [{ 1559 1560 }, 0.60], 1561 [{ 1562 translateY: '100%', 1563 scale: '1', 1564 // boxShadowBlur: '0' 1565 }, 0.40] 1566 ] 1567 }); 1568 $.Velocity.RegisterEffect("scaleUp.moveDown", { 1569 defaultDuration: 1, 1570 calls: [ 1571 [{ 1572 translateY: '-90%', 1573 scale: scaleDownAmnt, 1574 // boxShadowBlur: boxShadowAmnt 1575 }, 0.20], 1576 [{ 1577 translateY: '0%' 1578 }, 0.60], 1579 [{ 1580 translateY: '0%', 1581 scale: '1', 1582 // boxShadowBlur: '0' 1583 }, 0.20] 1584 ] 1585 }); 1586 1587 1588 1589 /** 1590 * Velo Slider 1591 * A Custom Slider using Velocity and Velocity UI effects 1592 */ 1593 1594 var VeloSlider = (function() { 1595 1596 /** 1597 * Global Settings 1598 */ 1599 var settings = { 1600 veloInit: $('.velo-slides').data('velo-slider'), 1601 $veloSlide: $('.velo-slide'), 1602 veloSlideBg: '.velo-slide-bg', 1603 navPrev: $('.velo-slides-nav').find('a.js-velo-slides-prev'), 1604 navNext: $('.velo-slides-nav').find('a.js-velo-slides-next'), 1605 veloBtn: $('.velo-slide-btn'), 1606 delta: 0, 1607 scrollThreshold: 7, 1608 currentSlide: 1, 1609 animating: false, 1610 animationDuration: 2000 1611 }; 1612 1613 1614 // Flags 1615 var delta = 0, 1616 animating = false; 1617 1618 return { 1619 1620 /** 1621 * Init 1622 */ 1623 init: function() { 1624 this.bind(); 1625 }, 1626 1627 /** 1628 * Bind our click, scroll, key events 1629 */ 1630 bind: function(){ 1631 1632 // Add active to first slide to set it off 1633 settings.$veloSlide.first().addClass('is-active'); 1634 1635 // Init with a data attribute, 1636 // Binding the animation to scroll, arrows, keys 1637 if (settings.veloInit == 'on') { 1638 VeloSlider.initScrollJack(); 1639 $(window).on('DOMMouseScroll mousewheel', VeloSlider.scrollJacking); 1640 } 1641 1642 // Arrow / Click Nav 1643 settings.navPrev.on('click', VeloSlider.prevSlide); 1644 settings.navNext.on('click', VeloSlider.nextSlide); 1645 1646 // Key Nav 1647 $(document).on('keydown', function(e) { 1648 var keyNext = (e.which == 39 || e.which == 40),
1649 keyPrev = (e.which == 37 || e.which == 38); 1650 1651 if (keyNext && !settings.navNext.hasClass('inactive')) { 1652 e.preventDefault(); 1653 VeloSlider.nextSlide(); 1654 1655 } else if (keyPrev && (!settings.navPrev.hasClass('inactive'))) { 1656 e.preventDefault(); 1657 VeloSlider.prevSlide(); 1658 } 1659 }); 1660 1661 jQuery('body').on('touchmove', function(e){ 1662 e.preventDefault(); 1663 e.stopPropagation(); 1664 1665 return false; 1666 }); 1667 1668 var ts; 1669 jQuery(document).bind('touchstart', function (e){ 1670 ts = e.originalEvent.touches[0].clientY; 1671 }); 1672 1673 jQuery(document).bind('touchend', function (e){ 1674 var te = e.originalEvent.changedTouches[0].clientY; 1675 if(ts > te+5){ 1676 VeloSlider.nextSlide(); 1677 }else if(ts < te-5){ 1678 VeloSlider.prevSlide(); 1679 } 1680 }); 1681 1682 //set navigation arrows visibility 1683 VeloSlider.checkNavigation(); 1684 1685 // Call Button Hover animation 1686 VeloSlider.hoverAnimation(); 1687 1688 }, 1689 1690 /** 1691 * Hover Animation 1692 * Adds 'is-hovering' class to the current slide 1693 * when hovering over the button. 1694 */ 1695 hoverAnimation: function(){ 1696 settings.veloBtn.hover(function (){ 1697 $(this).closest(settings.$veloSlide).toggleClass('is-hovering'); 1698 }); 1699 }, 1700 1701 /** 1702 * Set Animation 1703 * Defines the animation sequence, calling our registered velocity effects 1704 * @see js/components/_velocity-effects.js 1705 */ 1706 setAnimation: function(midStep, direction) { 1707 1708 // Vars for our velocity effects 1709 var animationVisible = 'translateNone', 1710 animationTop = 'translateUp', 1711 animationBottom = 'translateDown', 1712 easing = 'ease', 1713 animDuration = settings.animationDuration; 1714 1715 // Middle Step 1716 if (midStep) { 1717 animationVisible = 'scaleUp.moveUp.scroll'; 1718 animationTop = 'scaleDown.moveUp.scroll'; 1719 animationBottom = 'scaleDown.moveDown.scroll'; 1720 1721 } else { 1722 animationVisible = (direction == 'next') ? 'scaleUp.moveUp' : 'scaleUp.moveDown'; 1723 animationTop = 'scaleDown.moveUp'; 1724 animationBottom = 'scaleDown.moveDown'; 1725 } 1726 1727 return [animationVisible, animationTop, animationBottom, animDuration, easing]; 1728 }, 1729 1730 /** 1731 * Init Scroll Jaclk 1732 */ 1733 initScrollJack: function() { 1734 1735 var visibleSlide = settings.$veloSlide.filter('.is-active'), 1736 topSection = visibleSlide.prevAll(settings.$veloSlide), 1737 bottomSection = visibleSlide.nextAll(settings.$veloSlide), 1738 animationParams = VeloSlider.setAnimation(false), 1739 animationVisible = animationParams[0], 1740 animationTop = animationParams[1], 1741 animationBottom = animationParams[2]; 1742 1743 visibleSlide.children('div').velocity(animationVisible, 1, function() { 1744 visibleSlide.css('opacity', 1); 1745 topSection.css('opacity', 1); 1746 bottomSection.css('opacity', 1); 1747 }); 1748 1749 topSection.children('div').velocity(animationTop, 0); 1750 bottomSection.children('div').velocity(animationBottom, 0); 1751 }, 1752 1753 /** 1754 * Scroll Jack 1755 * On Mouse Scroll 1756 */ 1757 scrollJacking: function(e) { 1758 if(!jQuery('body').hasClass('js_nav')) 1759 { 1760 if (e.originalEvent.detail < 0 || e.originalEvent.wheelDelta > 0) { 1761 delta--; 1762 (Math.abs(delta) >= settings.scrollThreshold) && VeloSlider.prevSlide(); 1763 } else { 1764 delta++; 1765 (delta >= settings.scrollThreshold) && VeloSlider.nextSlide(); 1766 } 1767 return false; 1768 } 1769 }, 1770 1771 /** 1772 * Previous Slide 1773 */ 1774 prevSlide: function(e) { 1775 //go to previous section 1776 typeof e !== 'undefined' && e.preventDefault(); 1777 1778 var visibleSlide = settings.$veloSlide.filter('.is-active'), 1779 animationParams = VeloSlider.setAnimation(midStep, 'prev'), 1780 midStep = false;
1781 1782 visibleSlide = midStep ? visibleSlide.next(settings.$veloSlide) : visibleSlide; 1783 1784 if (!animating && !visibleSlide.is(":first-child")) { 1785 animating = true; 1786 1787 visibleSlide 1788 .removeClass('is-active') 1789 .children(settings.veloSlideBg) 1790 .velocity(animationParams[2], animationParams[3], animationParams[4]) 1791 .end() 1792 .prev(settings.$veloSlide) 1793 .addClass('is-active') 1794 .children(settings.veloSlideBg) 1795 .velocity(animationParams[0], animationParams[3], animationParams[4], function() { 1796 animating = false; 1797 }); 1798 currentSlide = settings.currentSlide - 1; 1799 } 1800 VeloSlider.resetScroll(); 1801 }, 1802 1803 1804 /** 1805 * Next Slide 1806 */ 1807 nextSlide: function(e) { 1808 1809 //go to next section 1810 typeof e !== 'undefined' && e.preventDefault(); 1811 1812 var visibleSlide = settings.$veloSlide.filter('.is-active'), 1813 animationParams = VeloSlider.setAnimation(midStep, 'next'), 1814 midStep = false; 1815 1816 if (!animating && !visibleSlide.is(":last-of-type")) { 1817 animating = true; 1818 1819 visibleSlide.removeClass('is-active') 1820 .children(settings.veloSlideBg) 1821 .velocity(animationParams[1], animationParams[3]) 1822 .end() 1823 .next(settings.$veloSlide) 1824 .addClass('is-active') 1825 .children(settings.veloSlideBg) 1826 .velocity(animationParams[0], animationParams[3], function() { 1827 animating = false; 1828 }); 1829 currentSlide = settings.currentSlide + 1; 1830 } 1831 VeloSlider.resetScroll(); 1832 }, 1833 1834 /** 1835 * Reset SCroll 1836 */ 1837 resetScroll: function() { 1838 delta = 0; 1839 VeloSlider.checkNavigation(); 1840 }, 1841 1842 /** 1843 * Check Nav 1844 * Adds / hides nav based on first/last slide 1845 * @todo - loop slides, without cloning if possible 1846 */ 1847 checkNavigation: function() { 1848 //update navigation arrows visibility 1849 (settings.$veloSlide.filter('.is-active').is(':first-of-type')) ? settings.navPrev.addClass('inactive'): settings.navPrev.removeClass('inactive'); 1850 (settings.$veloSlide.filter('.is-active').is(':last-of-type')) ? settings.navNext.addClass('inactive'): settings.navNext.removeClass('inactive'); 1851 1852 }, 1853 }; 1854 })(); 1855 1856 // INIT 1857 VeloSlider.init(); 1858 } ); 1859 //End execute javascript for slider velo 1860 1861 //Start execute javascript for slider popout 1862 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-popout.default', function( $scope ) { 1863 jQuery('body').addClass('elementor-fullscreen'); 1864 1865 function goToSlide(number){ 1866 $('.slider-slide').removeClass('slider-slide--active'); 1867 $('.slider-slide[data-slide='+number+']').addClass('slider-slide--active'); 1868 } 1869 1870 $('.slider__next, .go-to-next').on('click', function(){ 1871 var currentSlide = Number($('.slider-slide--active').data('slide')); 1872 var totalSlides = $('.slider-slide').length; 1873 currentSlide++ 1874 if (currentSlide > totalSlides){ 1875 currentSlide = 1; 1876 } 1877 goToSlide(currentSlide); 1878 }); 1879 1880 for (var i=1; i <= $('.slider-slide').length; i++){ 1881 $('.slider__indicators').append('<div class="slider__indicator" data-slide="'+i+'"></div>') 1882 } 1883 setTimeout(function(){ 1884 $('.slider-wrap').addClass('slider-wrap--hacked'); 1885 }, 1000); 1886 } ); 1887 //End execute javascript for slider popout 1888 1889 1890 //Start execute javascript for slider clip path 1891 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-clip-path.default', function( $scope ) { 1892 jQuery('body').addClass('elementor-fullscreen'); 1893 1894 (function() { 1895 var $slides = document.querySelectorAll('.slide'); 1896 var $controls = document.querySelectorAll('.slider-control'); 1897 var numOfSlides = $slides.length; 1898 var slidingAT = 1300; // sync this with scss variable 1899 var slidingBlocked = false;
1900 1901 [].slice.call($slides).forEach(function($el, index) { 1902 var i = index + 1; 1903 $el.classList.add('slide-' + i); 1904 $el.dataset.slide = i; 1905 }); 1906 1907 [].slice.call($controls).forEach(function($el) { 1908 $el.addEventListener('click', controlClickHandler); 1909 }); 1910 1911 function controlClickHandler() { 1912 if (slidingBlocked) return; 1913 slidingBlocked = true; 1914 1915 var $control = this; 1916 var isRight = $control.classList.contains('m--right'); 1917 var $curActive = document.querySelector('.slide.s--active'); 1918 var index = +$curActive.dataset.slide; 1919 (isRight) ? index++ : index--; 1920 if (index < 1) index = numOfSlides; 1921 if (index > numOfSlides) index = 1; 1922 var $newActive = document.querySelector('.slide-' + index); 1923 1924 $control.classList.add('a--rotation'); 1925 $curActive.classList.remove('s--active', 's--active-prev'); 1926 document.querySelector('.slide.s--prev').classList.remove('s--prev'); 1927 1928 $newActive.classList.add('s--active'); 1929 if (!isRight) $newActive.classList.add('s--active-prev'); 1930 1931 1932 var prevIndex = index - 1; 1933 if (prevIndex < 1) prevIndex = numOfSlides; 1934 1935 document.querySelector('.slide-' + prevIndex).classList.add('s--prev'); 1936 1937 setTimeout(function() { 1938 $control.classList.remove('a--rotation'); 1939 slidingBlocked = false; 1940 }, slidingAT*0.75); 1941 }; 1942 }()); 1943 } ); 1944 //End execute javascript for slider clip path 1945 1946 //Start execute javascript for gallery preview 1947 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-gallery-preview.default', function( $scope ) { 1948 jQuery('body').addClass('elementor-fullscreen'); 1949 jQuery('body').addClass('avante-gallery-preview'); 1950 1951 var $slider = $('.slider'); 1952 var $slickTrack = $('.slick-track'); 1953 var $slickCurrent = $('.slick-current'); 1954 1955 var slideDuration = 900; 1956 1957 //RESET ANIMATIONS 1958 // On init slide change 1959 $slider.on('init', function(slick){ 1960 TweenMax.to($('.slick-track'), 0.9, { 1961 marginLeft: 0 1962 }); 1963 TweenMax.to($('.slick-active'), 0.9, { 1964 x: 0, 1965 zIndex: 2 1966 }); 1967 }); 1968 // On before slide change 1969 $slider.on('beforeChange', function(event, slick, currentSlide, nextSlide){ 1970 TweenMax.to($('.slick-track'), 0.9, { 1971 marginLeft: 0 1972 }); 1973 TweenMax.to($('.slick-active'), 0.9, { 1974 x: 0 1975 }); 1976 }); 1977 1978 // On after slide change 1979 $slider.on('afterChange', function(event, slick, currentSlide){ 1980 TweenMax.to($('.slick-track'), 0.9, { 1981 marginLeft: 0 1982 }); 1983 $('.slick-slide').css('z-index','1'); 1984 TweenMax.to($('.slick-active'), 0.9, { 1985 x: 0, 1986 zIndex: 2 1987 }); 1988 }); 1989 1990 var $sliderPagination = $('.slider').attr('data-pagination'); 1991 var dotsVar = false; 1992 if($sliderPagination == 'yes') 1993 { 1994 dotsVar = true; 1995 } 1996 1997 var $sliderNavigation = $('.slider').attr('data-navigation'); 1998 var arrowsVar = false; 1999 if($sliderNavigation == 'yes') 2000 { 2001 arrowsVar = true; 2002 } 2003 2004 var $sliderAutoPlay = $('.slider').attr('data-autoplay'); 2005 var autoPlayVar = false; 2006 var autoPlayTimeVar = 0; 2007 if (typeof $sliderAutoPlay != "undefined"){ 2008 autoPlayVar = true; 2009 autoPlayTimeVar = $sliderAutoPlay; 2010 } 2011 2012 //SLICK INIT 2013 $slider.slick({ 2014 speed: slideDuration, 2015 touchMove: true, 2016 dots: dotsVar, 2017 arrows: arrowsVar, 2018 waitForAnimate: true, 2019 useTransform: true, 2020 autoplay: autoPlayVar, 2021 autoplaySpeed: autoPlayTimeVar, 2022 cssEase: 'cubic-bezier(0.455, 0.030, 0.130, 1.000)' 2023 }) 2024 2025 //PREV 2026 $('.slick-prev').on('mouseenter', function(){ 2027 TweenMax.to($('.slick-track'), 0.6, { 2028 marginLeft: "180px", 2029 ease: Quad.easeOut 2030 }); 2031 TweenMax.to($('.slick-current'), 0.6, { 2032 x: -100, 2033 ease: Quad.easeOut 2034 }); 2035 }); 2036 2037 $('.slick-prev').on('mouseleave', function(){ 2038 TweenMax.to($('.slick-track'), 0.4, { 2039 marginLeft: 0, 2040 ease: Sine.easeInOut 2041 }); 2042 TweenMax.to($('.slick-current'), 0.4, { 2043 x: 0, 2044 ease: Sine.easeInOut 2045 }); 2046 }); 2047 2048 //NEXT 2049 $('.slick-next').on('mouseenter', function(){ 2050 2051 TweenMax.to($('.slick-track'), 0.6, { 2052 marginLeft: "-180px", 2053 ease: Quad.easeOut 2054 }); 2055 TweenMax.to($('.slick-current'), 0.6, { 2056 x: 100, 2057 ease: Quad.easeOut 2058 }); 2059 }); 2060 2061 $('.slick-next').on('mouseleave', function(){ 2062 TweenMax.to($('.slick-track'), 0.4, { 2063 marginLeft: 0, 2064 ease: Quad.easeInOut 2065 }); 2066 TweenMax.to($('.slick-current'), 0.4, { 2067 x: 0, 2068 ease: Quad.easeInOut 2069 }); 2070 }); 2071 } ); 2072 //End execute javascript for gallery preview 2073 2074 //Start execute javascript for slider split slick 2075 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-split-slick.default', function( $scope ) { 2076 jQuery('body').addClass('elementor-fullscreen'); 2077 2078 var $slider = $('.slideshow .slider'), 2079 maxItems = $('.item', $slider).length, 2080 dragging = false, 2081 tracking, 2082 rightTracking; 2083 2084 $sliderRight = $('.slideshow').clone().addClass('slideshow-right').appendTo($('.split-slideshow')); 2085 2086 rightItems = $('.item', $sliderRight).toArray(); 2087 reverseItems = rightItems.reverse(); 2088 $('.slider', $sliderRight).html(''); 2089 for (i = 0; i < maxItems; i++) { 2090 $(reverseItems[i]).appendTo($('.slider', $sliderRight)); 2091 } 2092 2093 $slider.addClass('slideshow-left'); 2094 $('.slideshow-left').slick({ 2095 vertical: true, 2096 verticalSwiping: true,
2097 arrows: false, 2098 infinite: true, 2099 dots: true, 2100 speed: 1000, 2101 cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)' 2102 }).on('beforeChange', function(event, slick, currentSlide, nextSlide) { 2103 2104 if (currentSlide > nextSlide && nextSlide == 0 && currentSlide == maxItems - 1) { 2105 $('.slideshow-right .slider').slick('slickGoTo', -1); 2106 $('.slideshow-text').slick('slickGoTo', maxItems); 2107 } else if (currentSlide < nextSlide && currentSlide == 0 && nextSlide == maxItems - 1) { 2108 $('.slideshow-right .slider').slick('slickGoTo', maxItems); 2109 $('.slideshow-text').slick('slickGoTo', -1); 2110 } else { 2111 $('.slideshow-right .slider').slick('slickGoTo', maxItems - 1 - nextSlide); 2112 $('.slideshow-text').slick('slickGoTo', nextSlide); 2113 } 2114 }).on("mousewheel", function(event) { 2115 event.preventDefault(); 2116 if (event.deltaX > 0 || event.deltaY < 0) { 2117 $(this).slick('slickNext'); 2118 } else if (event.deltaX < 0 || event.deltaY > 0) { 2119 $(this).slick('slickPrev'); 2120 }; 2121 }).on('mousedown touchstart', function(){ 2122 dragging = true; 2123 tracking = $('.slick-track', $slider).css('transform'); 2124 tracking = parseInt(tracking.split(',')[5]); 2125 rightTracking = $('.slideshow-right .slick-track').css('transform'); 2126 rightTracking = parseInt(rightTracking.split(',')[5]); 2127 }).on('mousemove touchmove', function(){ 2128 if (dragging) { 2129 newTracking = $('.slideshow-left .slick-track').css('transform'); 2130 newTracking = parseInt(newTracking.split(',')[5]); 2131 diffTracking = newTracking - tracking; 2132 $('.slideshow-right .slick-track').css({'transform': 'matrix(1, 0, 0, 1, 0, ' + (rightTracking - diffTracking) + ')'}); 2133 } 2134 }).on('mouseleave touchend mouseup', function(){ 2135 dragging = false; 2136 }); 2137 2138 $('.slideshow-right .slider').slick({ 2139 swipe: false, 2140 vertical: true, 2141 arrows: false, 2142 infinite: true, 2143 speed: 950, 2144 cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)', 2145 initialSlide: maxItems - 1 2146 }); 2147 $('.slideshow-text').slick({ 2148 swipe: false, 2149 vertical: true, 2150 arrows: false, 2151 infinite: true, 2152 speed: 900, 2153 cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)' 2154 }); 2155 } ); 2156 //End execute javascript for slider split slick 2157 2158 //Start execute javascript for slider transitions 2159 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-transitions.default', function( $scope ) { 2160 jQuery('body').addClass('elementor-fullscreen'); 2161 2162 var mySwiper = new Swiper(".swiper-container", { 2163 direction: "vertical", 2164 loop: true, 2165 pagination: { 2166 el: '.swiper-pagination', 2167 type: 'bullets', 2168 clickable: true 2169 }, 2170 keyboard: { 2171 enabled: true, 2172 onlyInViewport: false, 2173 }, 2174 grabCursor: true, 2175 speed: 1000, 2176 paginationClickable: true, 2177 parallax: true, 2178 autoplay: false, 2179 effect: "slide", 2180 mousewheel: { 2181 invert: false, 2182 }, 2183 }); 2184 } ); 2185 //End execute javascript for slider transitions 2186 2187 2188 //Start execute javascript for slider property clip 2189 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-property-clip.default', function( $scope ) { 2190 jQuery(".slider-property-clip-wrapper").each(function() { 2191 var slider = jQuery(this).find(".slider"), 2192 slides = slider.find('li'), 2193 nav = slider.find('nav'); 2194 2195 slides.eq(0).addClass('current'); 2196 2197 nav.children('a').eq(0).addClass('current-dot'); 2198 2199 nav.on('click', 'a', function(event) { 2200 event.preventDefault(); 2201 $(this).addClass('current-dot').siblings().removeClass('current-dot'); 2202 slides.eq($(this).index()).addClass('current').removeClass('prev').siblings().removeClass('current'); 2203 slides.eq($(this).index()).prevAll().addClass('prev'); 2204 slides.eq($(this).index()).nextAll().removeClass('prev'); 2205 }); 2206 }); 2207 } ); 2208 //End execute javascript for slider property clip 2209 2210 //Start execute javascript for slider slice 2211 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-slice.default', function( $scope ) { 2212 jQuery(".slice-slide-container").each(function() { 2213 var slide = jQuery('.slide'); 2214 var navPrev = jQuery('.js-prev'); 2215 var navNext = jQuery('.js-next'); 2216 var SliceSlider = { 2217 2218 /** 2219 * Settings Object 2220 */ 2221 settings: { 2222 delta: 0, 2223 currentSlideIndex: 0, 2224 scrollThreshold: 40, 2225 slides: slide, 2226 numSlides: slide.length, 2227 navPrev: navPrev, 2228 navNext: navNext, 2229 }, 2230 2231 /** 2232 * Init 2233 */ 2234 init: function() { 2235 s = this.settings; 2236 this.bindEvents(); 2237 }, 2238 2239 /** 2240 * Bind our click, scroll, key events 2241 */ 2242 bindEvents: function(){ 2243 2244 // Scrollwheel & trackpad 2245 /*s.slides.on({ 2246 'DOMMouseScroll mousewheel' : SliceSlider.handleScroll 2247 });*/ 2248 // On click prev 2249 s.navPrev.on({ 2250 'click' : SliceSlider.prevSlide 2251 }); 2252 // On click next 2253 s.navNext.on({ 2254 'click' : SliceSlider.nextSlide 2255 }); 2256 // On Arrow keys 2257 $(document).keyup(function(e) { 2258 // Left or back arrows 2259 if ((e.which === 37) || (e.which === 38)){ 2260 SliceSlider.prevSlide(); 2261 } 2262 // Down or right 2263 if ((e.which === 39) || (e.which === 40)) { 2264 SliceSlider.nextSlide(); 2265 } 2266 }); 2267 }, 2268 2269 /** 2270 * Interept scroll direction 2271 */ 2272 handleScroll: function(e){ 2273 2274 // Scrolling up 2275 if (e.originalEvent.detail < 0 || e.originalEvent.wheelDelta > 0) { 2276 2277 s.delta--; 2278 2279 if ( Math.abs(s.delta) >= s.scrollThreshold) { 2280 SliceSlider.prevSlide(); 2281 } 2282 } 2283 2284 // Scrolling Down 2285 else { 2286 2287 s.delta++; 2288 2289 if (s.delta >= s.scrollThreshold) { 2290 SliceSlider.nextSlide(); 2291 } 2292 } 2293 2294 // Prevent page from scrolling 2295 return false;
2296 }, 2297 2298 /** 2299 * Show Slide 2300 */ 2301 showSlide: function(){ 2302 // reset 2303 s.delta = 0; 2304 // Bail if we're already sliding 2305 if ($('body').hasClass('is-sliding')){ 2306 return; 2307 } 2308 // Loop through our slides 2309 s.slides.each(function(i, slide) { 2310 2311 // Toggle the is-active class to show slide 2312 $(slide).toggleClass('is-active', (i === s.currentSlideIndex)); 2313 $(slide).toggleClass('is-prev', (i === s.currentSlideIndex - 1)); 2314 $(slide).toggleClass('is-next', (i === s.currentSlideIndex + 1)); 2315 2316 // Add and remove is-sliding class 2317 $('body').addClass('is-sliding'); 2318 2319 setTimeout(function(){ 2320 $('body').removeClass('is-sliding'); 2321 }, 1000); 2322 }); 2323 }, 2324 2325 /** 2326 * Previous Slide 2327 */ 2328 prevSlide: function(){ 2329 2330 // If on first slide, loop to last 2331 if (s.currentSlideIndex <= 0) { 2332 s.currentSlideIndex = s.numSlides; 2333 } 2334 s.currentSlideIndex--; 2335 2336 SliceSlider.showSlide(); 2337 }, 2338 2339 /** 2340 * Next Slide 2341 */ 2342 nextSlide: function(){ 2343 2344 s.currentSlideIndex++; 2345 2346 // If on last slide, loop to first 2347 if (s.currentSlideIndex >= s.numSlides) { 2348 s.currentSlideIndex = 0; 2349 } 2350 2351 SliceSlider.showSlide(); 2352 }, 2353 }; 2354 SliceSlider.init(); 2355 }); 2356 } ); 2357 //End execute javascript for slider slice 2358 2359 //Start execute javascript for slider flip 2360 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-flip.default', function( $scope ) { 2361 jQuery('body').addClass('elementor-fullscreen'); 2362 jQuery('body').addClass('elementor-overflow'); 2363 2364 var Gallery = (function() { 2365 var scrollTimeId; 2366 var posLeft = 0; 2367 2368 function Gallery(config) { 2369 this.list = $(config.list); 2370 this.items = this.list.find('li'); 2371 this.itemWidth = this.items.outerWidth(); 2372 }; 2373 2374 Gallery.prototype = { 2375 constructor: Gallery, 2376 2377 init: function() { 2378 this.setGalleryWidth(); 2379 this.eventManager(); 2380 2381 return this; 2382 }, 2383 2384 eventManager: function() { 2385 var _this = this; 2386 2387 $("html, body").on('mousewheel', function(event) { 2388 clearTimeout(scrollTimeId); 2389 scrollTimeId = setTimeout(onScrollEventHandler.bind(this, event, _this.itemWidth), 0); 2390 }); 2391 }, 2392 2393 setGalleryWidth: function() { 2394 this.list.css('width', this.getGalleryWidth()); 2395 this.list.css('overflow', 'scroll'); 2396 }, 2397 2398 getGalleryWidth: function() { 2399 var width = 0; 2400 2401 this.items.each(function(index, item) { 2402 width += $(this).outerWidth(); 2403 }); 2404 2405 return width; 2406 } 2407 }; 2408 2409 function onScrollEventHandler(event, width) { 2410 if (event.deltaY > 0) { 2411 this.scrollLeft -= width / 20; 2412 } else { 2413 this.scrollLeft += width / 20; 2414 } 2415 2416 event.preventDefault(); 2417 }; 2418 2419 return Gallery; 2420 })(); 2421 2422 2423 $(document).ready(function() { 2424 var gallery = new Gallery({ 2425 list: '.flip-slide-container .container .gallery' 2426 }).init(); 2427 2428 jQuery('.flip-slide-container').css('overflow', 'scroll'); 2429 jQuery('body').css('overflow', 'scroll'); 2430 }); 2431 } ); 2432 //End execute javascript for slider flip 2433 2434 //Start execute javascript for slider split carousel 2435 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-split-carousel.default', function( $scope ) { 2436 jQuery(".split-carousel-slider-wrapper").each(function() { 2437 var $carousel = jQuery(this); 2438 2439 var fullscreen = $carousel.attr('data-fullscreen'); 2440 if(fullscreen != 0) 2441 { 2442 jQuery('body').addClass('elementor-fullscreen'); 2443 2444 //Get menu element height
2445 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 2446 var documentHeight = jQuery(window).innerHeight(); 2447 var sliderHeight = parseInt(documentHeight - menuHeight); 2448 2449 $carousel.css('height', sliderHeight+'px'); 2450 2451 jQuery( window ).resize(function() { 2452 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 2453 var documentHeight = jQuery(window).innerHeight(); 2454 var sliderHeight = parseInt(documentHeight - menuHeight); 2455 2456 $carousel.css('height', sliderHeight+'px'); 2457 }); 2458 } 2459 2460 var activeIndex = 0; 2461 var limit = 0; 2462 var disabled = false; 2463 var $stage = void 0; 2464 var $controls = void 0; 2465 var canvas = false; 2466 2467 var SPIN_FORWARD_CLASS = 'js-spin-fwd'; 2468 var SPIN_BACKWARD_CLASS = 'js-spin-bwd'; 2469 var DISABLE_TRANSITIONS_CLASS = 'js-transitions-disabled'; 2470 var SPIN_DUR = 1000; 2471 2472 var appendControls = function appendControls() { 2473 for (var i = 0; i < limit; i++) { 2474 $('.carousel-control').append('<a href="#" data-index="' + i + '"></a>'); 2475 } 2476 var height = $('.carousel-control').children().last().outerHeight(); 2477 2478 $('.carousel-control').css('height', 30 + limit * height); 2479 $controls = $('.carousel-control').children(); 2480 $controls.eq(activeIndex).addClass('active'); 2481 }; 2482 2483 var setIndexes = function setIndexes() { 2484 $('.spinner').children().each(function (i, el) { 2485 $(el).attr('data-index', i); 2486 limit++; 2487 }); 2488 }; 2489 2490 var duplicateSpinner = function duplicateSpinner() { 2491 var $el = $('.spinner').parent(); 2492 var html = $('.spinner').parent().html(); 2493 $el.append(html); 2494 $('.spinner').last().addClass('spinner--right'); 2495 $('.spinner--right').removeClass('spinner--left'); 2496 }; 2497 2498 var paintFaces = function paintFaces() { 2499 $('.spinner-face').each(function (i, el) { 2500 var $el = $(el); 2501 var color = $(el).attr('data-bg'); 2502 $el.children().css('backgroundImage', 'url(' + getBase64PixelByColor(color) + ')'); 2503 }); 2504 }; 2505 2506 var getBase64PixelByColor = function getBase64PixelByColor(hex) { 2507 if (!canvas) { 2508 canvas = document.createElement('canvas'); 2509 canvas.height = 1; 2510 canvas.width = 1; 2511 } 2512 if (canvas.getContext) { 2513 var ctx = canvas.getContext('2d'); 2514 ctx.fillStyle = hex; 2515 ctx.fillRect(0, 0, 1, 1); 2516 return canvas.toDataURL(); 2517 } 2518 return false; 2519 }; 2520 2521 var prepareDom = function prepareDom() { 2522 setIndexes(); 2523 paintFaces(); 2524 duplicateSpinner(); 2525 appendControls(); 2526 }; 2527 2528 var spin = function spin() { 2529 var inc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; 2530 2531 if (disabled) return; 2532 if (!inc) return; 2533 activeIndex += inc; 2534 disabled = true; 2535 2536 if (activeIndex >= limit) { 2537 activeIndex = 0; 2538 } 2539 2540 if (activeIndex < 0) { 2541 activeIndex = limit - 1; 2542 } 2543 2544 var $activeEls = $('.spinner-face.js-active'); 2545 var $nextEls = $('.spinner-face[data-index=' + activeIndex + ']'); 2546 $nextEls.addClass('js-next'); 2547 2548 if (inc > 0) { 2549 $stage.addClass(SPIN_FORWARD_CLASS); 2550 } else { 2551 $stage.addClass(SPIN_BACKWARD_CLASS); 2552 } 2553 2554 $controls.removeClass('active'); 2555 $controls.eq(activeIndex).addClass('active'); 2556 2557 setTimeout(function () { 2558 spinCallback(inc); 2559 }, SPIN_DUR, inc); 2560 }; 2561 2562 var spinCallback = function spinCallback(inc) { 2563 2564 $('.js-active').removeClass('js-active'); 2565 $('.js-next').removeClass('js-next').addClass('js-active'); 2566 $stage.addClass(DISABLE_TRANSITIONS_CLASS).removeClass(SPIN_FORWARD_CLASS).removeClass(SPIN_BACKWARD_CLASS); 2567 2568 $('.js-active').each(function (i, el) { 2569 var $el = $(el); 2570 $el.prependTo($el.parent()); 2571 }); 2572 setTimeout(function () { 2573 $stage.removeClass(DISABLE_TRANSITIONS_CLASS); 2574 disabled = false;
2575 }, 100); 2576 }; 2577 2578 var attachListeners = function attachListeners() { 2579 2580 document.onkeyup = function (e) { 2581 switch (e.keyCode) { 2582 case 38: 2583 spin(-1); 2584 break; 2585 case 40: 2586 spin(1); 2587 break; 2588 } 2589 }; 2590 2591 $carousel.bind('DOMMouseScroll', function(e){ 2592 if(e.originalEvent.detail > 0) { 2593 //scroll down 2594 spin(1); 2595 }else { 2596 //scroll up 2597 spin(-1); 2598 } 2599 2600 //prevent page fom scrolling 2601 return false; 2602 }); 2603 2604 //IE, Opera, Safari 2605 $carousel.bind('mousewheel', function(e){ 2606 if(e.originalEvent.wheelDelta < 0) { 2607 //scroll down 2608 spin(1); 2609 }else { 2610 //scroll up 2611 spin(-1); 2612 } 2613 2614 //prevent page fom scrolling 2615 return false; 2616 }); 2617 2618 jQuery('body').on('touchmove', function(e){ 2619 e.preventDefault(); 2620 e.stopPropagation(); 2621 2622 return false; 2623 }); 2624 2625 var ts; 2626 $carousel.bind('touchstart', function (e){ 2627 ts = e.originalEvent.touches[0].clientY; 2628 }); 2629 2630 $carousel.bind('touchend', function (e){ 2631 var te = e.originalEvent.changedTouches[0].clientY; 2632 if(ts > te+5){ 2633 spin(1); 2634 }else if(ts < te-5){ 2635 spin(-1); 2636 } 2637 }); 2638 2639 $controls.on('click', function (e) { 2640 e.preventDefault(); 2641 if (disabled) return; 2642 var $el = $(e.target); 2643 var toIndex = parseInt($el.attr('data-index'), 10); 2644 spin(toIndex - activeIndex); 2645 }); 2646 }; 2647 2648 var assignEls = function assignEls() { 2649 $stage = $('.carousel-stage'); 2650 }; 2651 2652 var init = function init() { 2653 assignEls(); 2654 prepareDom(); 2655 attachListeners(); 2656 }; 2657 2658 $(function () { 2659 init(); 2660 }); 2661 }); 2662 } ); 2663 //End execute javascript for slider split carousel 2664 2665 //Start execute javascript for horizontal timeline 2666 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-horizontal-timeline.default', function( $scope ) { 2667 var timelines = jQuery('.cd-horizontal-timeline'); 2668 var eventsMinDistance = timelines.attr('data-spacing'); 2669 2670 if(eventsMinDistance == '') 2671 { 2672 eventsMinDistance = 60; 2673 } 2674 2675 (timelines.length > 0) && initTimeline(timelines); 2676 2677 function initTimeline(timelines) { 2678 timelines.each(function(){ 2679 var timeline = jQuery(this), 2680 timelineComponents = {}; 2681 //cache timeline components 2682 timelineComponents['timelineWrapper'] = timeline.find('.events-wrapper'); 2683 timelineComponents['eventsWrapper'] = timelineComponents['timelineWrapper'].children('.events'); 2684 timelineComponents['fillingLine'] = timelineComponents['eventsWrapper'].children('.filling-line'); 2685 timelineComponents['timelineEvents'] = timelineComponents['eventsWrapper'].find('a'); 2686 timelineComponents['timelineDates'] = parseDate(timelineComponents['timelineEvents']); 2687 timelineComponents['eventsMinLapse'] = minLapse(timelineComponents['timelineDates']); 2688 timelineComponents['timelineNavigation'] = timeline.find('.cd-timeline-navigation'); 2689 timelineComponents['eventsContent'] = timeline.children('.events-content'); 2690 2691 //assign a left postion to the single events along the timeline 2692 setDatePosition(timelineComponents, eventsMinDistance); 2693 //assign a width to the timeline 2694 var timelineTotWidth = setTimelineWidth(timelineComponents, eventsMinDistance); 2695 //the timeline has been initialize - show it 2696 timeline.addClass('loaded'); 2697 2698 //detect click on the next arrow 2699 timelineComponents['timelineNavigation'].on('click', '.next', function(event){ 2700 event.preventDefault(); 2701 updateSlide(timelineComponents, timelineTotWidth, 'next'); 2702 }); 2703 //detect click on the prev arrow 2704 timelineComponents['timelineNavigation'].on('click', '.prev', function(event){ 2705 event.preventDefault(); 2706 updateSlide(timelineComponents, timelineTotWidth, 'prev'); 2707 }); 2708 //detect click on the a single event - show new event content 2709 timelineComponents['eventsWrapper'].on('click', 'a', function(event){ 2710 event.preventDefault(); 2711 timelineComponents['timelineEvents'].removeClass('selected'); 2712 jQuery(this).addClass('selected'); 2713 updateOlderEvents(jQuery(this)); 2714 updateFilling(jQuery(this), timelineComponents['fillingLine'], timelineTotWidth); 2715 updateVisibleContent(jQuery(this), timelineComponents['eventsContent']); 2716 }); 2717 2718 //on swipe, show next/prev event content 2719 timelineComponents['eventsContent'].on('swipeleft', function(){ 2720 var mq = checkMQ(); 2721 ( mq == 'mobile' ) && showNewContent(timelineComponents, timelineTotWidth, 'next'); 2722 }); 2723 timelineComponents['eventsContent'].on('swiperight', function(){ 2724 var mq = checkMQ(); 2725 ( mq == 'mobile' ) && showNewContent(timelineComponents, timelineTotWidth, 'prev'); 2726 }); 2727 2728 //keyboard navigation 2729 jQuery(document).keyup(function(event){ 2730 if(event.which=='37' && elementInViewport(timeline.get(0)) ) { 2731 showNewContent(timelineComponents, timelineTotWidth, 'prev'); 2732 } else if( event.which=='39' && elementInViewport(timeline.get(0))) { 2733 showNewContent(timelineComponents, timelineTotWidth, 'next'); 2734 } 2735 }); 2736 }); 2737 } 2738 2739 function updateSlide(timelineComponents, timelineTotWidth, string) { 2740 //retrieve translateX value of timelineComponents['eventsWrapper'] 2741 var translateValue = getTranslateValue(timelineComponents['eventsWrapper']),
2742 wrapperWidth = Number(timelineComponents['timelineWrapper'].css('width').replace('px', '')); 2743 //translate the timeline to the left('next')/right('prev') 2744 (string == 'next') 2745 ? translateTimeline(timelineComponents, translateValue - wrapperWidth + eventsMinDistance, wrapperWidth - timelineTotWidth) 2746 : translateTimeline(timelineComponents, translateValue + wrapperWidth - eventsMinDistance); 2747 } 2748 2749 function showNewContent(timelineComponents, timelineTotWidth, string) { 2750 //go from one event to the next/previous one 2751 var visibleContent = timelineComponents['eventsContent'].find('.selected'), 2752 newContent = ( string == 'next' ) ? visibleContent.next() : visibleContent.prev(); 2753 2754 if ( newContent.length > 0 ) { //if there's a next/prev event - show it 2755 var selectedDate = timelineComponents['eventsWrapper'].find('.selected'), 2756 newEvent = ( string == 'next' ) ? selectedDate.parent('li').next('li').children('a') : selectedDate.parent('li').prev('li').children('a'); 2757 2758 updateFilling(newEvent, timelineComponents['fillingLine'], timelineTotWidth); 2759 updateVisibleContent(newEvent, timelineComponents['eventsContent']); 2760 newEvent.addClass('selected'); 2761 selectedDate.removeClass('selected'); 2762 updateOlderEvents(newEvent); 2763 updateTimelinePosition(string, newEvent, timelineComponents, timelineTotWidth); 2764 } 2765 } 2766 2767 function updateTimelinePosition(string, event, timelineComponents, timelineTotWidth) { 2768 //translate timeline to the left/right according to the position of the selected event 2769 var eventStyle = window.getComputedStyle(event.get(0), null), 2770 eventLeft = Number(eventStyle.getPropertyValue("left").replace('px', '')), 2771 timelineWidth = Number(timelineComponents['timelineWrapper'].css('width').replace('px', '')), 2772 timelineTotWidth = Number(timelineComponents['eventsWrapper'].css('width').replace('px', '')); 2773 var timelineTranslate = getTranslateValue(timelineComponents['eventsWrapper']); 2774 2775 if( (string == 'next' && eventLeft > timelineWidth - timelineTranslate) || (string == 'prev' && eventLeft < - timelineTranslate) ) { 2776 translateTimeline(timelineComponents, - eventLeft + timelineWidth/2, timelineWidth - timelineTotWidth); 2777 } 2778 } 2779 2780 function translateTimeline(timelineComponents, value, totWidth) { 2781 var eventsWrapper = timelineComponents['eventsWrapper'].get(0); 2782 value = (value > 0) ? 0 : value; //only negative translate value 2783 value = ( !(typeof totWidth === 'undefined') && value < totWidth ) ? totWidth : value; //do not translate more than timeline width 2784 setTransformValue(eventsWrapper, 'translateX', value+'px'); 2785 //update navigation arrows visibility 2786 (value == 0 ) ? timelineComponents['timelineNavigation'].find('.prev').addClass('inactive') : timelineComponents['timelineNavigation'].find('.prev').removeClass('inactive'); 2787 (value == totWidth ) ? timelineComponents['timelineNavigation'].find('.next').addClass('inactive') : timelineComponents['timelineNavigation'].find('.next').removeClass('inactive'); 2788 } 2789 2790 function updateFilling(selectedEvent, filling, totWidth) { 2791 //change .filling-line length according to the selected event 2792 var eventStyle = window.getComputedStyle(selectedEvent.get(0), null), 2793 eventLeft = eventStyle.getPropertyValue("left"), 2794 eventWidth = eventStyle.getPropertyValue("width"); 2795 eventLeft = Number(eventLeft.replace('px', '')) + Number(eventWidth.replace('px', ''))/2; 2796 var scaleValue = eventLeft/totWidth; 2797 setTransformValue(filling.get(0), 'scaleX', scaleValue); 2798 } 2799 2800 function setDatePosition(timelineComponents, min) { 2801 for (i = 0; i < timelineComponents['timelineDates'].length; i++) { 2802 var distance = daydiff(timelineComponents['timelineDates'][0], timelineComponents['timelineDates'][i]), 2803 distanceNorm = Math.round(distance/timelineComponents['eventsMinLapse']) + 2; 2804 timelineComponents['timelineEvents'].eq(i).css('left', distanceNorm*min+'px'); 2805 } 2806 } 2807 2808 function setTimelineWidth(timelineComponents, width) { 2809 var timeSpan = daydiff(timelineComponents['timelineDates'][0], timelineComponents['timelineDates'][timelineComponents['timelineDates'].length-1]), 2810 timeSpanNorm = timeSpan/timelineComponents['eventsMinLapse'], 2811 timeSpanNorm = Math.round(timeSpanNorm) + 4, 2812 totalWidth = timeSpanNorm*width; 2813 timelineComponents['eventsWrapper'].css('width', totalWidth+'px'); 2814 updateFilling(timelineComponents['timelineEvents'].eq(0), timelineComponents['fillingLine'], totalWidth); 2815 2816 return totalWidth; 2817 } 2818 2819 function updateVisibleContent(event, eventsContent) { 2820 var eventDate = event.data('date'), 2821 visibleContent = eventsContent.find('.selected'), 2822 selectedContent = eventsContent.find('[data-date="'+ eventDate +'"]'), 2823 selectedContentHeight = selectedContent.height(); 2824 2825 if (selectedContent.index() > visibleContent.index()) { 2826 var classEnetering = 'selected enter-right', 2827 classLeaving = 'leave-left'; 2828 } else { 2829 var classEnetering = 'selected enter-left', 2830 classLeaving = 'leave-right'; 2831 } 2832 2833 selectedContent.attr('class', classEnetering); 2834 visibleContent.attr('class', classLeaving).one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(){ 2835 visibleContent.removeClass('leave-right leave-left'); 2836 selectedContent.removeClass('enter-left enter-right'); 2837 }); 2838 eventsContent.css('height', selectedContentHeight+'px'); 2839 } 2840 2841 function updateOlderEvents(event) { 2842 event.parent('li').prevAll('li').children('a').addClass('older-event').end().end().nextAll('li').children('a').removeClass('older-event'); 2843 } 2844 2845 function getTranslateValue(timeline) { 2846 var timelineStyle = window.getComputedStyle(timeline.get(0), null), 2847 timelineTranslate = timelineStyle.getPropertyValue("-webkit-transform") || 2848 timelineStyle.getPropertyValue("-moz-transform") || 2849 timelineStyle.getPropertyValue("-ms-transform") || 2850 timelineStyle.getPropertyValue("-o-transform") || 2851 timelineStyle.getPropertyValue("transform"); 2852 2853 if( timelineTranslate.indexOf('(') >=0 ) { 2854 var timelineTranslate = timelineTranslate.split('(')[1]; 2855 timelineTranslate = timelineTranslate.split(')')[0]; 2856 timelineTranslate = timelineTranslate.split(','); 2857 var translateValue = timelineTranslate[4]; 2858 } else { 2859 var translateValue = 0; 2860 } 2861 2862 return Number(translateValue); 2863 } 2864 2865 function setTransformValue(element, property, value) { 2866 element.style["-webkit-transform"] = property+"("+value+")"; 2867 element.style["-moz-transform"] = property+"("+value+")"; 2868 element.style["-ms-transform"] = property+"("+value+")"; 2869 element.style["-o-transform"] = property+"("+value+")"; 2870 element.style["transform"] = property+"("+value+")"; 2871 } 2872 2873 //based on http://stackoverflow.com/questions/542938/how-do-i-get-the-number-of-days-between-two-dates-in-javascript 2874 function parseDate(events) { 2875 var dateArrays = []; 2876 events.each(function(){ 2877 var dateComp = jQuery(this).data('date').split('/'), 2878 newDate = new Date(dateComp[2], dateComp[1]-1, dateComp[0]); 2879 dateArrays.push(newDate); 2880 }); 2881 return dateArrays; 2882 } 2883 2884 function parseDate2(events) { 2885 var dateArrays = []; 2886 events.each(function(){ 2887 var singleDate = jQuery(this), 2888 dateComp = singleDate.data('date').split('T'); 2889 if( dateComp.length > 1 ) { //both DD/MM/YEAR and time are provided 2890 var dayComp = dateComp[0].split('/'), 2891 timeComp = dateComp[1].split(':'); 2892 } else if( dateComp[0].indexOf(':') >=0 ) { //only time is provide 2893 var dayComp = ["2000", "0", "0"], 2894 timeComp = dateComp[0].split(':'); 2895 } else { //only DD/MM/YEAR 2896 var dayComp = dateComp[0].split('/'), 2897 timeComp = ["0", "0"]; 2898 } 2899 var newDate = new Date(dayComp[2], dayComp[1]-1, dayComp[0], timeComp[0], timeComp[1]); 2900 dateArrays.push(newDate); 2901 }); 2902 return dateArrays; 2903 } 2904 2905 function daydiff(first, second) { 2906 return Math.round((second-first)); 2907 } 2908 2909 function minLapse(dates) { 2910 //determine the minimum distance among events 2911 var dateDistances = []; 2912 for (i = 1; i < dates.length; i++) { 2913 var distance = daydiff(dates[i-1], dates[i]); 2914 dateDistances.push(distance); 2915 } 2916 return Math.min.apply(null, dateDistances); 2917 } 2918 2919 /* 2920 How to tell if a DOM element is visible in the current viewport? 2921 http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport 2922 */ 2923 function elementInViewport(el) { 2924 var top = el.offsetTop; 2925 var left = el.offsetLeft; 2926 var width = el.offsetWidth; 2927 var height = el.offsetHeight; 2928 2929 while(el.offsetParent) { 2930 el = el.offsetParent; 2931 top += el.offsetTop; 2932 left += el.offsetLeft; 2933 } 2934 2935 return ( 2936 top < (window.pageYOffset + window.innerHeight) && 2937 left < (window.pageXOffset + window.innerWidth) && 2938 (top + height) > window.pageYOffset && 2939 (left + width) > window.pageXOffset 2940 ); 2941 } 2942 2943 function checkMQ() { 2944 //check if mobile or desktop device 2945 return window.getComputedStyle(document.querySelector('.cd-horizontal-timeline'), '::before').getPropertyValue('content').replace(/'/g, "").replace(/"/g, ""); 2946 } 2947 } ); 2948 //End execute javascript for horizontal timeline 2949 2950 2951 //Start execute javascript for background list 2952 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-background-list.default', function( $scope ) { 2953 jQuery(".background-list-wrapper").each(function() { 2954 var parentDiv = jQuery(this); 2955 2956 parentDiv.children('.background-list-column').hover(function () { 2957 parentDiv.find('.background-list-img').removeClass('hover'); 2958 jQuery(this).next('.background-list-img').addClass('hover'); 2959 }); 2960 }); 2961 } ); 2962 //End execute javascript for background list 2963 2964 2965 //Start execute javascript for portfolio masonry 2966 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-masonry.default', function( $scope ) { 2967 jQuery(function( $ ) { 2968 2969 jQuery(".portfolio-masonry-content-wrapper.do-masonry").each(function() { 2970 var grid = jQuery(this); 2971 var cols = grid.attr('data-cols'); 2972 cols = parseInt(cols); 2973 2974 var gutter = 50; 2975 switch(cols) 2976 { 2977 case 2: 2978 gutter = 50; 2979 break; 2980 case 3: 2981 gutter = 40; 2982 break; 2983 case 4: 2984 gutter = 30; 2985 break; 2986 case 5: 2987 gutter = 20; 2988 break; 2989 } 2990 2991 grid.imagesLoaded().progress( function() { 2992 grid.masonry({ 2993 itemSelector: ".gallery-grid-item", 2994 columnWidth: ".gallery-grid-item", 2995 gutter : gutter 2996 }); 2997 }); 2998 2999 jQuery(".portfolio-masonry-content-wrapper.do-masonry img.lazy_masonry").each(function() { 3000 var currentImg = jQuery(this); 3001 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 3002 3003 var cols = grid.attr('data-cols'); 3004 3005 var gutter = 50; 3006 switch(cols) 3007 { 3008 case 2: 3009 gutter = 50; 3010 break; 3011 case 3: 3012 gutter = 40; 3013 break; 3014 case 4: 3015 gutter = 30; 3016 break; 3017 case 5: 3018 gutter = 20; 3019 break; 3020 } 3021 3022 jQuery(this).Lazy({ 3023 onFinishedAll: function() { 3024 grid.masonry({ 3025 itemSelector: ".gallery-grid-item", 3026 columnWidth: ".gallery-grid-item", 3027 gutter : gutter 3028 }); 3029 }, 3030 }); 3031 }); 3032 3033 jQuery(".portfolio-masonry-container").each(function() { 3034 var containderDiv = jQuery(this); 3035 var selectedClass = ""; 3036 3037 containderDiv.find(".filter-tag-btn").on('click', function(){ 3038 containderDiv.find(".filter-tag-btn").removeClass("active"); 3039 jQuery(this).addClass("active"); 3040 selectedClass = jQuery(this).attr("data-rel"); 3041 3042 var gridDiv = containderDiv.find(".portfolio-masonry-content-wrapper.do-masonry"); 3043 gridDiv.fadeTo(100, 0);
3044 gridDiv.find(".portfolio-masonry-grid-wrapper").css({ 3045 opacity: 0, 3046 display: 'none', 3047 transform: 'scale(0.0)' 3048 }); 3049 gridDiv.find(".portfolio-masonry-grid-wrapper").not("."+selectedClass).fadeOut().removeClass('scale-anm'); 3050 3051 setTimeout(function() { 3052 jQuery("."+selectedClass).fadeIn().addClass('scale-anm'); 3053 3054 jQuery("."+selectedClass).css({ 3055 opacity: 1, 3056 display: 'block', 3057 transform: 'scale(1,1)' 3058 }); 3059 3060 gridDiv.masonry('destroy'); 3061 var $grid = gridDiv.masonry({ 3062 itemSelector: ".portfolio-masonry-grid-wrapper.scale-anm", 3063 columnWidth: ".portfolio-masonry-grid-wrapper.scale-anm", 3064 gutter : gutter 3065 }); 3066 3067 $grid.masonry('reloadItems'); 3068 3069 setTimeout(function() { 3070 gridDiv.fadeTo(300, 1); 3071 }, 300); 3072 3073 }, 300); 3074 }); 3075 }); 3076 }); 3077 }); 3078 } ); 3079 //End execute javascript for portfolio masonry 3080 3081 3082 //Start execute javascript for portfolio masonry grid 3083 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-masonry-grid.default', function( $scope ) { 3084 jQuery(function( $ ) { 3085 3086 jQuery(".portfolio-masonry-content-wrapper.do-masonry").each(function() { 3087 var grid = jQuery(this); 3088 var cols = grid.attr('data-cols'); 3089 cols = parseInt(cols); 3090 3091 var gutter = 50; 3092 switch(cols) 3093 { 3094 case 2: 3095 gutter = 50; 3096 break; 3097 case 3: 3098 gutter = 40; 3099 break; 3100 case 4: 3101 gutter = 30; 3102 break; 3103 case 5: 3104 gutter = 20; 3105 break; 3106 } 3107 3108 grid.imagesLoaded().progress( function() { 3109 grid.masonry({ 3110 itemSelector: ".gallery-grid-item", 3111 columnWidth: ".gallery-grid-item", 3112 gutter : gutter 3113 }); 3114 }); 3115 3116 jQuery(".portfolio-masonry-content-wrapper.do-masonry img.lazy_masonry").each(function() { 3117 var currentImg = jQuery(this); 3118 currentImg.parent("div.post-featured-image-hover").removeClass("lazy"); 3119 3120 var cols = grid.attr('data-cols'); 3121 3122 var gutter = 50; 3123 switch(cols) 3124 { 3125 case 2: 3126 gutter = 50; 3127 break; 3128 case 3: 3129 gutter = 40; 3130 break; 3131 case 4: 3132 gutter = 30; 3133 break; 3134 case 5: 3135 gutter = 20; 3136 break; 3137 } 3138 3139 jQuery(this).Lazy({ 3140 onFinishedAll: function() { 3141 grid.masonry({ 3142 itemSelector: ".gallery-grid-item", 3143 columnWidth: ".gallery-grid-item", 3144 gutter : gutter 3145 }); 3146 }, 3147 }); 3148 }); 3149 3150 jQuery(".portfolio-masonry-container").each(function() { 3151 var containderDiv = jQuery(this); 3152 var selectedClass = ""; 3153 3154 containderDiv.find(".filter-tag-btn").on('click', function(){ 3155 containderDiv.find(".filter-tag-btn").removeClass("active"); 3156 jQuery(this).addClass("active"); 3157 selectedClass = jQuery(this).attr("data-rel"); 3158 3159 var gridDiv = containderDiv.find(".portfolio-masonry-content-wrapper.do-masonry"); 3160 gridDiv.fadeTo(100, 0); 3161 gridDiv.find(".portfolio-masonry-grid-wrapper").css({ 3162 opacity: 0, 3163 display: 'none', 3164 transform: 'scale(0.0)' 3165 }); 3166 gridDiv.find(".portfolio-masonry-grid-wrapper").not("."+selectedClass).fadeOut().removeClass('scale-anm'); 3167 3168 setTimeout(function() { 3169 jQuery("."+selectedClass).fadeIn().addClass('scale-anm'); 3170 3171 jQuery("."+selectedClass).css({ 3172 opacity: 1, 3173 display: 'block', 3174 transform: 'scale(1,1)' 3175 }); 3176 3177 gridDiv.masonry('destroy'); 3178 var $grid = gridDiv.masonry({ 3179 itemSelector: ".portfolio-masonry-grid-wrapper.scale-anm", 3180 columnWidth: ".portfolio-masonry-grid-wrapper.scale-anm", 3181 gutter : gutter 3182 }); 3183 3184 $grid.masonry('reloadItems'); 3185 3186 setTimeout(function() { 3187 gridDiv.fadeTo(300, 1); 3188 }, 300); 3189 3190 }, 300); 3191 }); 3192 }); 3193 }); 3194 }); 3195 } ); 3196 //End execute javascript for portfolio masonry grid 3197 3198 3199 //Start execute javascript for portfolio timeline 3200 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-timeline.default', function( $scope ) { 3201 var timelines = jQuery('.cd-horizontal-timeline'); 3202 var eventsMinDistance = timelines.attr('data-spacing'); 3203 3204 if(eventsMinDistance == '') 3205 { 3206 eventsMinDistance = 60; 3207 } 3208 3209 (timelines.length > 0) && initTimeline(timelines); 3210 3211 function initTimeline(timelines) { 3212 timelines.each(function(){ 3213 var timeline = jQuery(this), 3214 timelineComponents = {}; 3215 //cache timeline components 3216 timelineComponents['timelineWrapper'] = timeline.find('.events-wrapper'); 3217 timelineComponents['eventsWrapper'] = timelineComponents['timelineWrapper'].children('.events'); 3218 timelineComponents['fillingLine'] = timelineComponents['eventsWrapper'].children('.filling-line'); 3219 timelineComponents['timelineEvents'] = timelineComponents['eventsWrapper'].find('a'); 3220 timelineComponents['timelineDates'] = parseDate(timelineComponents['timelineEvents']); 3221 timelineComponents['eventsMinLapse'] = minLapse(timelineComponents['timelineDates']); 3222 timelineComponents['timelineNavigation'] = timeline.find('.cd-timeline-navigation'); 3223 timelineComponents['eventsContent'] = timeline.children('.events-content'); 3224 3225 //assign a left postion to the single events along the timeline 3226 setDatePosition(timelineComponents, eventsMinDistance); 3227 //assign a width to the timeline 3228 var timelineTotWidth = setTimelineWidth(timelineComponents, eventsMinDistance); 3229 //the timeline has been initialize - show it 3230 timeline.addClass('loaded'); 3231 3232 //detect click on the next arrow 3233 timelineComponents['timelineNavigation'].on('click', '.next', function(event){ 3234 event.preventDefault(); 3235 updateSlide(timelineComponents, timelineTotWidth, 'next'); 3236 }); 3237 //detect click on the prev arrow 3238 timelineComponents['timelineNavigation'].on('click', '.prev', function(event){ 3239 event.preventDefault(); 3240 updateSlide(timelineComponents, timelineTotWidth, 'prev'); 3241 }); 3242 //detect click on the a single event - show new event content 3243 timelineComponents['eventsWrapper'].on('click', 'a', function(event){ 3244 event.preventDefault(); 3245 timelineComponents['timelineEvents'].removeClass('selected'); 3246 jQuery(this).addClass('selected'); 3247 updateOlderEvents(jQuery(this)); 3248 updateFilling(jQuery(this), timelineComponents['fillingLine'], timelineTotWidth); 3249 updateVisibleContent(jQuery(this), timelineComponents['eventsContent']); 3250 }); 3251 3252 //on swipe, show next/prev event content 3253 timelineComponents['eventsContent'].on('swipeleft', function(){ 3254 var mq = checkMQ(); 3255 ( mq == 'mobile' ) && showNewContent(timelineComponents, timelineTotWidth, 'next'); 3256 }); 3257 timelineComponents['eventsContent'].on('swiperight', function(){ 3258 var mq = checkMQ(); 3259 ( mq == 'mobile' ) && showNewContent(timelineComponents, timelineTotWidth, 'prev'); 3260 }); 3261 3262 //keyboard navigation 3263 jQuery(document).keyup(function(event){ 3264 if(event.which=='37' && elementInViewport(timeline.get(0)) ) { 3265 showNewContent(timelineComponents, timelineTotWidth, 'prev'); 3266 } else if( event.which=='39' && elementInViewport(timeline.get(0))) { 3267 showNewContent(timelineComponents, timelineTotWidth, 'next'); 3268 } 3269 }); 3270 }); 3271 } 3272 3273 function updateSlide(timelineComponents, timelineTotWidth, string) { 3274 //retrieve translateX value of timelineComponents['eventsWrapper'] 3275 var translateValue = getTranslateValue(timelineComponents['eventsWrapper']),
3276 wrapperWidth = Number(timelineComponents['timelineWrapper'].css('width').replace('px', '')); 3277 //translate the timeline to the left('next')/right('prev') 3278 (string == 'next') 3279 ? translateTimeline(timelineComponents, translateValue - wrapperWidth + eventsMinDistance, wrapperWidth - timelineTotWidth) 3280 : translateTimeline(timelineComponents, translateValue + wrapperWidth - eventsMinDistance); 3281 } 3282 3283 function showNewContent(timelineComponents, timelineTotWidth, string) { 3284 //go from one event to the next/previous one 3285 var visibleContent = timelineComponents['eventsContent'].find('.selected'), 3286 newContent = ( string == 'next' ) ? visibleContent.next() : visibleContent.prev(); 3287 3288 if ( newContent.length > 0 ) { //if there's a next/prev event - show it 3289 var selectedDate = timelineComponents['eventsWrapper'].find('.selected'), 3290 newEvent = ( string == 'next' ) ? selectedDate.parent('li').next('li').children('a') : selectedDate.parent('li').prev('li').children('a'); 3291 3292 updateFilling(newEvent, timelineComponents['fillingLine'], timelineTotWidth); 3293 updateVisibleContent(newEvent, timelineComponents['eventsContent']); 3294 newEvent.addClass('selected'); 3295 selectedDate.removeClass('selected'); 3296 updateOlderEvents(newEvent); 3297 updateTimelinePosition(string, newEvent, timelineComponents, timelineTotWidth); 3298 } 3299 } 3300 3301 function updateTimelinePosition(string, event, timelineComponents, timelineTotWidth) { 3302 //translate timeline to the left/right according to the position of the selected event 3303 var eventStyle = window.getComputedStyle(event.get(0), null), 3304 eventLeft = Number(eventStyle.getPropertyValue("left").replace('px', '')), 3305 timelineWidth = Number(timelineComponents['timelineWrapper'].css('width').replace('px', '')), 3306 timelineTotWidth = Number(timelineComponents['eventsWrapper'].css('width').replace('px', '')); 3307 var timelineTranslate = getTranslateValue(timelineComponents['eventsWrapper']); 3308 3309 if( (string == 'next' && eventLeft > timelineWidth - timelineTranslate) || (string == 'prev' && eventLeft < - timelineTranslate) ) { 3310 translateTimeline(timelineComponents, - eventLeft + timelineWidth/2, timelineWidth - timelineTotWidth); 3311 } 3312 } 3313 3314 function translateTimeline(timelineComponents, value, totWidth) { 3315 var eventsWrapper = timelineComponents['eventsWrapper'].get(0); 3316 value = (value > 0) ? 0 : value; //only negative translate value 3317 value = ( !(typeof totWidth === 'undefined') && value < totWidth ) ? totWidth : value; //do not translate more than timeline width 3318 setTransformValue(eventsWrapper, 'translateX', value+'px'); 3319 //update navigation arrows visibility 3320 (value == 0 ) ? timelineComponents['timelineNavigation'].find('.prev').addClass('inactive') : timelineComponents['timelineNavigation'].find('.prev').removeClass('inactive'); 3321 (value == totWidth ) ? timelineComponents['timelineNavigation'].find('.next').addClass('inactive') : timelineComponents['timelineNavigation'].find('.next').removeClass('inactive'); 3322 } 3323 3324 function updateFilling(selectedEvent, filling, totWidth) { 3325 //change .filling-line length according to the selected event 3326 var eventStyle = window.getComputedStyle(selectedEvent.get(0), null), 3327 eventLeft = eventStyle.getPropertyValue("left"), 3328 eventWidth = eventStyle.getPropertyValue("width"); 3329 eventLeft = Number(eventLeft.replace('px', '')) + Number(eventWidth.replace('px', ''))/2; 3330 var scaleValue = eventLeft/totWidth; 3331 setTransformValue(filling.get(0), 'scaleX', scaleValue); 3332 } 3333 3334 function setDatePosition(timelineComponents, min) { 3335 for (i = 0; i < timelineComponents['timelineDates'].length; i++) { 3336 var distance = daydiff(timelineComponents['timelineDates'][0], timelineComponents['timelineDates'][i]), 3337 distanceNorm = Math.round(distance/timelineComponents['eventsMinLapse']) + 2; 3338 timelineComponents['timelineEvents'].eq(i).css('left', distanceNorm*min+'px'); 3339 } 3340 } 3341 3342 function setTimelineWidth(timelineComponents, width) { 3343 var timeSpan = daydiff(timelineComponents['timelineDates'][0], timelineComponents['timelineDates'][timelineComponents['timelineDates'].length-1]), 3344 timeSpanNorm = timeSpan/timelineComponents['eventsMinLapse'], 3345 timeSpanNorm = Math.round(timeSpanNorm) + 4, 3346 totalWidth = timeSpanNorm*width; 3347 timelineComponents['eventsWrapper'].css('width', totalWidth+'px'); 3348 updateFilling(timelineComponents['timelineEvents'].eq(0), timelineComponents['fillingLine'], totalWidth); 3349 3350 return totalWidth; 3351 } 3352 3353 function updateVisibleContent(event, eventsContent) { 3354 var eventDate = event.data('date'), 3355 visibleContent = eventsContent.find('.selected'), 3356 selectedContent = eventsContent.find('[data-date="'+ eventDate +'"]'), 3357 selectedContentHeight = selectedContent.height(); 3358 3359 if (selectedContent.index() > visibleContent.index()) { 3360 var classEnetering = 'selected enter-right', 3361 classLeaving = 'leave-left'; 3362 } else { 3363 var classEnetering = 'selected enter-left', 3364 classLeaving = 'leave-right'; 3365 } 3366 3367 selectedContent.attr('class', classEnetering); 3368 visibleContent.attr('class', classLeaving).one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(){ 3369 visibleContent.removeClass('leave-right leave-left'); 3370 selectedContent.removeClass('enter-left enter-right'); 3371 }); 3372 eventsContent.css('height', selectedContentHeight+'px'); 3373 } 3374 3375 function updateOlderEvents(event) { 3376 event.parent('li').prevAll('li').children('a').addClass('older-event').end().end().nextAll('li').children('a').removeClass('older-event'); 3377 } 3378 3379 function getTranslateValue(timeline) { 3380 var timelineStyle = window.getComputedStyle(timeline.get(0), null), 3381 timelineTranslate = timelineStyle.getPropertyValue("-webkit-transform") || 3382 timelineStyle.getPropertyValue("-moz-transform") || 3383 timelineStyle.getPropertyValue("-ms-transform") || 3384 timelineStyle.getPropertyValue("-o-transform") || 3385 timelineStyle.getPropertyValue("transform"); 3386 3387 if( timelineTranslate.indexOf('(') >=0 ) { 3388 var timelineTranslate = timelineTranslate.split('(')[1]; 3389 timelineTranslate = timelineTranslate.split(')')[0]; 3390 timelineTranslate = timelineTranslate.split(','); 3391 var translateValue = timelineTranslate[4]; 3392 } else { 3393 var translateValue = 0; 3394 } 3395 3396 return Number(translateValue); 3397 } 3398 3399 function setTransformValue(element, property, value) { 3400 element.style["-webkit-transform"] = property+"("+value+")"; 3401 element.style["-moz-transform"] = property+"("+value+")"; 3402 element.style["-ms-transform"] = property+"("+value+")"; 3403 element.style["-o-transform"] = property+"("+value+")"; 3404 element.style["transform"] = property+"("+value+")"; 3405 } 3406 3407 //based on http://stackoverflow.com/questions/542938/how-do-i-get-the-number-of-days-between-two-dates-in-javascript 3408 function parseDate(events) { 3409 var dateArrays = []; 3410 events.each(function(){ 3411 var dateComp = jQuery(this).data('date').split('/'), 3412 newDate = new Date(dateComp[2], dateComp[1]-1, dateComp[0]); 3413 dateArrays.push(newDate); 3414 }); 3415 return dateArrays; 3416 } 3417 3418 function parseDate2(events) { 3419 var dateArrays = []; 3420 events.each(function(){ 3421 var singleDate = jQuery(this), 3422 dateComp = singleDate.data('date').split('T'); 3423 if( dateComp.length > 1 ) { //both DD/MM/YEAR and time are provided 3424 var dayComp = dateComp[0].split('/'), 3425 timeComp = dateComp[1].split(':'); 3426 } else if( dateComp[0].indexOf(':') >=0 ) { //only time is provide 3427 var dayComp = ["2000", "0", "0"], 3428 timeComp = dateComp[0].split(':'); 3429 } else { //only DD/MM/YEAR 3430 var dayComp = dateComp[0].split('/'), 3431 timeComp = ["0", "0"]; 3432 } 3433 var newDate = new Date(dayComp[2], dayComp[1]-1, dayComp[0], timeComp[0], timeComp[1]); 3434 dateArrays.push(newDate); 3435 }); 3436 return dateArrays; 3437 } 3438 3439 function daydiff(first, second) { 3440 return Math.round((second-first)); 3441 } 3442 3443 function minLapse(dates) { 3444 //determine the minimum distance among events 3445 var dateDistances = []; 3446 for (i = 1; i < dates.length; i++) { 3447 var distance = daydiff(dates[i-1], dates[i]); 3448 dateDistances.push(distance); 3449 } 3450 return Math.min.apply(null, dateDistances); 3451 } 3452 3453 /* 3454 How to tell if a DOM element is visible in the current viewport? 3455 http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport 3456 */ 3457 function elementInViewport(el) { 3458 var top = el.offsetTop; 3459 var left = el.offsetLeft; 3460 var width = el.offsetWidth; 3461 var height = el.offsetHeight; 3462 3463 while(el.offsetParent) { 3464 el = el.offsetParent; 3465 top += el.offsetTop; 3466 left += el.offsetLeft; 3467 } 3468 3469 return ( 3470 top < (window.pageYOffset + window.innerHeight) && 3471 left < (window.pageXOffset + window.innerWidth) && 3472 (top + height) > window.pageYOffset && 3473 (left + width) > window.pageXOffset 3474 ); 3475 } 3476 3477 function checkMQ() { 3478 //check if mobile or desktop device 3479 return window.getComputedStyle(document.querySelector('.cd-horizontal-timeline'), '::before').getPropertyValue('content').replace(/'/g, "").replace(/"/g, ""); 3480 } 3481 } ); 3482 //End execute javascript for portfolio timeline vertical 3483 3484 3485 //Start execute javascript for background list 3486 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-timeline-vertical.default', function( $scope ) { 3487 jQuery(".portfolio-timeline-vertical-content-wrapper").each(function() { 3488 var slideshow = jQuery(this); 3489 var autoPlay = slideshow.attr('data-autoplay'); 3490 var autoPlayArr = false;
3491 if (typeof autoPlay != "undefined"){ 3492 autoPlayArr = { 3493 delay: autoPlay 3494 }; 3495 } 3496 3497 var speed = slideshow.attr('data-speed'); 3498 if (typeof speed == "undefined"){ 3499 speed = 1600; 3500 } 3501 3502 var timelineSwiper = new Swiper ('.portfolio-timeline-vertical-content-wrapper .timeline .swiper-container', { 3503 direction: 'vertical', 3504 slidesPerView: 1, 3505 loop: false, 3506 speed: parseInt(speed), 3507 autoplay: autoPlayArr, 3508 pagination: { 3509 el: '.swiper-pagination', 3510 type: 'bullets', 3511 renderBullet: function (index, className) { 3512 var year = document.querySelectorAll('.swiper-slide')[index].getAttribute('data-year'); 3513 return '<span class="' + className + '">' + year + '</span>';; 3514 }, 3515 clickable: true 3516 }, 3517 navigation: { 3518 nextEl: '.swiper-button-next', 3519 prevEl: '.swiper-button-prev', 3520 }, 3521 breakpoints: { 3522 768: { 3523 direction: 'horizontal', 3524 } 3525 }, 3526 on: { 3527 init: function () { 3528 slideshow.delay(100).queue(function (next) { 3529 jQuery(this).addClass('active'); 3530 }); 3531 }, 3532 } 3533 }); 3534 }); 3535 } ); 3536 //End execute javascript for portfolio timeline vertical 3537 3538 //Start execute javascript for slider parallax 3539 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-parallax.default', function( $scope ) { 3540 3541 var slideshow=jQuery('.slider-parallax-wrapper'); 3542 var timer = slideshow.attr('data-autoplay'); 3543 var autoplay = true; 3544 3545 if(timer == 0) 3546 { 3547 timer = false; 3548 autoplay = false; 3549 } 3550 3551 var pagination = slideshow.attr('data-pagination'); 3552 if(pagination == 0) 3553 { 3554 var pagination = false; 3555 } 3556 else 3557 { 3558 var pagination = true; 3559 } 3560 3561 var navigation = slideshow.attr('data-navigation'); 3562 if(navigation == 0) 3563 { 3564 var navigation = false; 3565 } 3566 else 3567 { 3568 var navigation = true; 3569 } 3570 3571 var slideshowDuration = timer; 3572 3573 function slideshowSwitch(slideshow,index,auto){ 3574 if(slideshow.data('wait')) return; 3575 3576 var slides = slideshow.find('.slide'); 3577 var pages = slideshow.find('.pagination'); 3578 var activeSlide = slides.filter('.is-active'); 3579 var activeSlideImage = activeSlide.find('.image-container'); 3580 var newSlide = slides.eq(index); 3581 var newSlideImage = newSlide.find('.image-container'); 3582 var newSlideContent = newSlide.find('.slide-content'); 3583 var newSlideElements=newSlide.find('.caption > *'); 3584 if(newSlide.is(activeSlide))return; 3585 3586 newSlide.addClass('is-new'); 3587 var timeout=slideshow.data('timeout'); 3588 clearTimeout(timeout); 3589 slideshow.data('wait',true); 3590 var transition=slideshow.attr('data-transition'); 3591 if(transition=='fade'){ 3592 newSlide.css({ 3593 display:'block', 3594 zIndex:2 3595 }); 3596 newSlideImage.css({ 3597 opacity:0 3598 }); 3599 3600 TweenMax.to(newSlideImage,1,{ 3601 alpha:1, 3602 onComplete:function(){ 3603 newSlide.addClass('is-active').removeClass('is-new'); 3604 activeSlide.removeClass('is-active'); 3605 newSlide.css({display:'',zIndex:''}); 3606 newSlideImage.css({opacity:''}); 3607 slideshow.find('.pagination').trigger('check'); 3608 slideshow.data('wait',false); 3609 if(auto){ 3610 timeout=setTimeout(function(){ 3611 slideshowNext(slideshow,false,true); 3612 },slideshowDuration); 3613 slideshow.data('timeout',timeout);}}}); 3614 } else { 3615 if(newSlide.index()>activeSlide.index()){ 3616 var newSlideRight=0; 3617 var newSlideLeft='auto'; 3618 var newSlideImageRight=-slideshow.width()/8; 3619 var newSlideImageLeft='auto'; 3620 var newSlideImageToRight=0; 3621 var newSlideImageToLeft='auto'; 3622 var newSlideContentLeft='auto'; 3623 var newSlideContentRight=0; 3624 var activeSlideImageLeft=-slideshow.width()/4; 3625 } else { 3626 var newSlideRight=''; 3627 var newSlideLeft=0; 3628 var newSlideImageRight='auto'; 3629 var newSlideImageLeft=-slideshow.width()/8; 3630 var newSlideImageToRight=''; 3631 var newSlideImageToLeft=0; 3632 var newSlideContentLeft=0; 3633 var newSlideContentRight='auto'; 3634 var activeSlideImageLeft=slideshow.width()/4; 3635 } 3636 3637 newSlide.css({ 3638 display:'block', 3639 width:0,
3640 right:newSlideRight, 3641 left:newSlideLeft 3642 ,zIndex:2 3643 }); 3644 3645 newSlideImage.css({ 3646 width:slideshow.width(), 3647 right:newSlideImageRight, 3648 left:newSlideImageLeft 3649 }); 3650 3651 newSlideContent.css({ 3652 width:slideshow.width(), 3653 left:newSlideContentLeft, 3654 right:newSlideContentRight 3655 }); 3656 3657 activeSlideImage.css({ 3658 left:0 3659 }); 3660 3661 TweenMax.set(newSlideElements,{y:20,force3D:true}); 3662 TweenMax.to(activeSlideImage,1,{ 3663 left:activeSlideImageLeft, 3664 ease:Power3.easeInOut 3665 }); 3666 3667 TweenMax.to(newSlide,1,{ 3668 width:slideshow.width(), 3669 ease:Power3.easeInOut 3670 }); 3671 3672 TweenMax.to(newSlideImage,1,{ 3673 right:newSlideImageToRight, 3674 left:newSlideImageToLeft, 3675 ease:Power3.easeInOut 3676 }); 3677 3678 TweenMax.staggerFromTo(newSlideElements,0.8,{alpha:0,y:60},{alpha:1,y:0,ease:Power3.easeOut,force3D:true,delay:0.6},0.1,function(){ 3679 newSlide.addClass('is-active').removeClass('is-new'); 3680 activeSlide.removeClass('is-active'); 3681 newSlide.css({ 3682 display:'', 3683 width:'', 3684 left:'', 3685 zIndex:'' 3686 }); 3687 3688 newSlideImage.css({ 3689 width:'', 3690 right:'', 3691 left:'' 3692 }); 3693 3694 newSlideContent.css({ 3695 width:'', 3696 left:'' 3697 }); 3698 3699 newSlideElements.css({ 3700 opacity:'', 3701 transform:'' 3702 }); 3703 3704 activeSlideImage.css({ 3705 left:'' 3706 }); 3707 3708 slideshow.find('.pagination').trigger('check'); 3709 slideshow.data('wait',false); 3710 if(auto){ 3711 timeout=setTimeout(function(){ 3712 slideshowNext(slideshow,false,true); 3713 },slideshowDuration); 3714 slideshow.data('timeout',timeout); 3715 } 3716 }); 3717 } 3718 } 3719 3720 function slideshowNext(slideshow,previous,auto){ 3721 var slides=slideshow.find('.slide'); 3722 var activeSlide=slides.filter('.is-active'); 3723 var newSlide=null; 3724 if(previous){ 3725 newSlide=activeSlide.prev('.slide'); 3726 if(newSlide.length === 0) { 3727 newSlide=slides.last(); 3728 } 3729 } else { 3730 newSlide=activeSlide.next('.slide'); 3731 if(newSlide.length==0) 3732 newSlide=slides.filter('.slide').first(); 3733 } 3734 3735 slideshowSwitch(slideshow,newSlide.index(),auto); 3736 } 3737 3738 function homeSlideshowParallax(){ 3739 var scrollTop=jQuery(window).scrollTop(); 3740 if(scrollTop>windowHeight) return; 3741 var inner=slideshow.find('.slideshow-inner'); 3742 var newHeight=windowHeight-(scrollTop/2); 3743 var newTop=scrollTop*0.8; 3744 3745 inner.css({ 3746 transform:'translateY('+newTop+'px)',height:newHeight 3747 }); 3748 } 3749 3750 jQuery(document).ready(function() { 3751 jQuery('.slider-parallax-wrapper .slide').addClass('is-loaded'); 3752 3753 jQuery('.slider-parallax-wrapper .arrows .arrow').on('click',function(){ 3754 slideshowNext(jQuery(this).closest('.slider-parallax-wrapper'),jQuery(this).hasClass('prev')); 3755 }); 3756 3757 jQuery('.slider-parallax-wrapper .pagination .item').on('click',function(){ 3758 slideshowSwitch(jQuery(this).closest('.slider-parallax-wrapper'),jQuery(this).index()); 3759 }); 3760 3761 jQuery('.slider-parallax-wrapper .pagination').on('check',function(){ 3762 var slideshow=jQuery(this).closest('.slider-parallax-wrapper'); 3763 var pages=jQuery(this).find('.item'); 3764 var index=slideshow.find('.slider_parallax_slides .is-active').index(); 3765 pages.removeClass('is-active'); 3766 pages.eq(index).addClass('is-active'); 3767 }); 3768 3769 if(autoplay) 3770 { 3771 var timeout=setTimeout(function(){ 3772 slideshowNext(slideshow,false,true); 3773 },slideshowDuration); 3774 3775 slideshow.data('timeout',timeout); 3776 } 3777 }); 3778 } ); 3779 //End execute javascript for slider parallax 3780 3781 3782 //Start execute javascript for distortion grid 3783 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-distortion-grid.default', function( $scope ) { 3784 Array.from(document.querySelectorAll('.distortion-grid-item-img')).forEac
3784h((el) => { 3785 const imgs = Array.from(el.querySelectorAll('img')); 3786 new hoverEffect({ 3787 parent: el, 3788 intensity: el.dataset.intensity || undefined, 3789 speedIn: el.dataset.speedin || undefined, 3790 speedOut: el.dataset.speedout || undefined, 3791 easing: el.dataset.easing || undefined, 3792 hover: el.dataset.hover || undefined, 3793 image1: imgs[0].getAttribute('src'), 3794 image2: imgs[1].getAttribute('src'), 3795 displacementImage: el.dataset.displacement 3796 }); 3797 }); 3798 } ); 3799 //End execute javascript for distortion grid 3800 3801 3802 //Start execute javascript for slider animated 3803 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-animated.default', function( $scope ) { 3804 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 3805 3806 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3807 3808 var $window = jQuery(window); 3809 var $body = jQuery('body'); 3810 3811 var Slideshow = function () { 3812 function Slideshow() { 3813 var _this = this; 3814 3815 var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 3816 3817 _classCallCheck(this, Slideshow); 3818 3819 var defaultOptions = { 3820 $el: jQuery('.animated-slider-wrapper'),
3821 showArrows: false, 3822 showPagination: true, 3823 duration: 10000, 3824 autoplay: true 3825 }; 3826 3827 var options = Object.assign({}, defaultOptions, userOptions); 3828 3829 this.$el = options.$el; 3830 this.maxSlide = this.$el.find(jQuery('.js-slider-home-slide')).length; 3831 this.showArrows = this.maxSlide > 1 ? options.showArrows : false; 3832 this.showPagination = options.showPagination; 3833 this.currentSlide = 1; 3834 this.isAnimating = false; 3835 this.animationDuration = 1200; 3836 this.autoplaySpeed = options.duration; 3837 this.interval; 3838 this.$controls = this.$el.find('.js-slider-home-button'); 3839 this.autoplay = this.maxSlide > 1 ? options.autoplay : false; 3840 this.autoplay = false; 3841 3842 this.$el.on('click', '.js-slider-home-next', function (event) { 3843 return _this.nextSlide(); 3844 }); 3845 this.$el.on('click', '.js-slider-home-prev', function (event) { 3846 return _this.prevSlide(); 3847 }); 3848 this.$el.on('click', '.js-pagination-item', function (event) { 3849 if (!_this.isAnimating) { 3850 _this.preventClick(); 3851 _this.goToSlide(event.target.dataset.slide); 3852 } 3853 }); 3854 3855 this.init(); 3856 } 3857 3858 _createClass(Slideshow, [{ 3859 key: 'init', 3860 value: function init() { 3861 this.goToSlide(1); 3862 3863 if (this.autoplay) { 3864 this.startAutoplay(); 3865 } 3866 3867 if (this.showPagination) { 3868 var paginationNumber = this.maxSlide; 3869 var pagination = '<div class="pagination"><div class="container">'; 3870 3871 for (var i = 0; i < this.maxSlide; i++) { 3872 var item = '<span class="pagination-item js-pagination-item ' + (i === 0 ? 'is-current' : '') + '" data-slide=' + (i + 1) + '>' + (i + 1) + '</span>'; 3873 pagination = pagination + item; 3874 } 3875 3876 pagination = pagination + '</div></div>'; 3877 3878 this.$el.append(pagination); 3879 } 3880 } 3881 }, { 3882 key: 'preventClick', 3883 value: function preventClick() { 3884 var _this2 = this; 3885 3886 this.isAnimating = true; 3887 this.$controls.prop('disabled', true); 3888 clearInterval(this.interval); 3889 3890 setTimeout(function () { 3891 _this2.isAnimating = false; 3892 _this2.$controls.prop('disabled', false); 3893 if (_this2.autoplay) { 3894 _this2.startAutoplay(); 3895 } 3896 }, this.animationDuration); 3897 } 3898 }, { 3899 key: 'goToSlide', 3900 value: function goToSlide(index) { 3901 this.currentSlide = parseInt(index); 3902 3903 if (this.currentSlide > this.maxSlide) { 3904 this.currentSlide = 1; 3905 } 3906 3907 if (this.currentSlide === 0) { 3908 this.currentSlide = this.maxSlide; 3909 } 3910 3911 var newCurrent = this.$el.find('.js-slider-home-slide[data-slide="' + this.currentSlide + '"]'); 3912 var newPrev = this.currentSlide === 1 ? this.$el.find('.js-slider-home-slide').last() : newCurrent.prev('.js-slider-home-slide'); 3913 var newNext = this.currentSlide === this.maxSlide ? this.$el.find('.js-slider-home-slide').first() : newCurrent.next('.js-slider-home-slide'); 3914 3915 this.$el.find('.js-slider-home-slide').removeClass('is-prev is-next is-current'); 3916 this.$el.find('.js-pagination-item').removeClass('is-current'); 3917 3918 if (this.maxSlide > 1) { 3919 newPrev.addClass('is-prev'); 3920 newNext.addClass('is-next'); 3921 } 3922 3923 newCurrent.addClass('is-current');
3924 this.$el.find('.js-pagination-item[data-slide="' + this.currentSlide + '"]').addClass('is-current'); 3925 } 3926 }, { 3927 key: 'nextSlide', 3928 value: function nextSlide() { 3929 this.preventClick(); 3930 this.goToSlide(this.currentSlide + 1); 3931 } 3932 }, { 3933 key: 'prevSlide', 3934 value: function prevSlide() { 3935 this.preventClick(); 3936 this.goToSlide(this.currentSlide - 1); 3937 } 3938 }, { 3939 key: 'startAutoplay', 3940 value: function startAutoplay() { 3941 var _this3 = this; 3942 3943 this.interval = setInterval(function () { 3944 if (!_this3.isAnimating) { 3945 _this3.nextSlide(); 3946 } 3947 }, this.autoplaySpeed); 3948 } 3949 }, { 3950 key: 'destroy', 3951 value: function destroy() { 3952 this.$el.off(); 3953 } 3954 }]); 3955 3956 return Slideshow; 3957 }(); 3958 3959 (function () { 3960 var loaded = false; 3961 var maxLoad = 3000; 3962 3963 function load() { 3964 var options = { 3965 showPagination: true 3966 }; 3967 3968 var slideShow = new Slideshow(options); 3969 } 3970 3971 function addLoadClass() { 3972 $body.addClass('is-loaded'); 3973 3974 setTimeout(function () { 3975 $body.addClass('is-animated'); 3976 }, 600); 3977 } 3978 3979 $window.on('load', function () { 3980 if (!loaded) { 3981 loaded = true; 3982 load(); 3983 } 3984 }); 3985 3986 setTimeout(function () { 3987 if (!loaded) { 3988 loaded = true; 3989 load(); 3990 } 3991 }, maxLoad); 3992 3993 addLoadClass(); 3994 })(); 3995 } ); 3996 //End execute javascript for slider animated 3997 3998 3999 //Start execute javascript for fade up slider 4000 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-fadeup.default', function( $scope ) { 4001 function init(item) { 4002 var items = item.querySelectorAll('li'), 4003 current = 0, 4004 autoUpdate = true; 4005 4006 //create nav 4007 var nav = document.createElement('nav'); 4008 nav.className = 'nav_arrows'; 4009 4010 //create button prev 4011 var prevbtn = document.createElement('button'); 4012 prevbtn.className = 'prev'; 4013 prevbtn.setAttribute('aria-label', 'Prev'); 4014 4015 //create button next 4016 var nextbtn = document.createElement('button'); 4017 nextbtn.className = 'next'; 4018 nextbtn.setAttribute('aria-label', 'Next'); 4019 4020 //create counter 4021 var counter = document.createElement('div'); 4022 counter.className = 'counter'; 4023 counter.innerHTML = "<span>1</span><span>"+items.length+"</span>"; 4024 4025 if (items.length > 1) { 4026 nav.appendChild(prevbtn); 4027 nav.appendChild(counter); 4028 nav.appendChild(nextbtn); 4029 item.appendChild(nav); 4030 } 4031 4032 items[current].className = "current"; 4033 if (items.length > 1) items[items.length-1].className = "prev-slide"; 4034 4035 var navigate = function(dir) { 4036 items[current].className = ""; 4037 4038 if (dir === 'right') { 4039 current = current < items.length-1 ? current + 1 : 0; 4040 } else { 4041 current = current > 0 ? current - 1 : items.length-1; 4042 } 4043 4044 var nextCurrent = current < items.length-1 ? current + 1 : 0, 4045 prevCurrent = current > 0 ? current - 1 : items.length-1; 4046 4047 items[current].className = "current"; 4048 items[prevCurrent].className = "prev-slide"; 4049 items[nextCurrent].className = ""; 4050 4051 //update counter 4052 counter.firstChild.textContent = current + 1; 4053 } 4054 4055 item.addEventListener('mouseenter', function() { 4056 autoUpdate = false; 4057 }); 4058 4059 item.addEventListener('mouseleave', function() { 4060 autoUpdate = true; 4061 }); 4062 4063 prevbtn.addEventListener('click', function() { 4064 navigate('left'); 4065 }); 4066 4067 nextbtn.addEventListener('click', function() { 4068 navigate('right'); 4069 }); 4070 4071 //keyboard navigation 4072 document.addEventListener('keydown', function(ev) { 4073 var keyCode = ev.keyCode || ev.which; 4074 switch (keyCode) { 4075 case 37: 4076 navigate('left'); 4077 break; 4078 case 39: 4079 navigate('right'); 4080 break; 4081 } 4082 }); 4083 4084 // swipe navigation 4085 // from http://stackoverflow.com/a/23230280 4086 item.addEventListener('touchstart', handleTouchStart, false); 4087 item.addEventListener('touchmove', handleTouchMove, false); 4088 var xDown = null; 4089 var yDown = null; 4090 function handleTouchStart(evt) { 4091 xDown = evt.touches[0].clientX; 4092 yDown = evt.touches[0].clientY; 4093 }; 4094 function handleTouchMove(evt) { 4095 if ( ! xDown || ! yDown ) { 4096 return; 4097 } 4098 4099 var xUp = evt.touches[0].clientX; 4100 var yUp = evt.touches[0].clientY; 4101 4102 var xDiff = xDown - xUp; 4103 var yDiff = yDown - yUp; 4104 4105 if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {/*most significant*/ 4106 if ( xDiff > 0 ) { 4107 /* left swipe */ 4108 navigate('right'); 4109 } else { 4110 navigate('left'); 4111 } 4112 } 4113 /* reset values */ 4114 xDown = null; 4115 yDown = null; 4116 }; 4117 4118 4119 } 4120 4121 [].slice.call(document.querySelectorAll('.fadeup-slider-wrapper')).forEac
4121h( function(item) { 4122 init(item); 4123 }); 4124 } ); 4125 //End execute javascript for fade up slider 4126 4127 4128 //Start execute javascript for motion reveal slider 4129 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-motion-reveal.default', function( $scope ) { 4130 // The Slide class. 4131 class Slide { 4132 constructor(el) { 4133 this.DOM = {el: el}; 4134 // The image conteiner. 4135 this.DOM.imgWrap = this.DOM.el.querySelector('.slide-img-wrap'); 4136 // The revealer element (the element with the same color of the body that covers the image). 4137 this.DOM.revealer = this.DOM.imgWrap.querySelector('.slide-img-reveal'); 4138 // The title element. 4139 this.DOM.title = this.DOM.el.querySelector('.slide-title'); 4140 // The slide´s number element 4141 this.DOM.number = this.DOM.el.querySelector('.slide-number'); 4142 // The large preview elements (also an image and revealer for the cover/uncover effect) 4143 this.DOM.preview = { 4144 imgWrap: this.DOM.el.querySelector('.preview-img-wrap'), 4145 revealer: this.DOM.el.querySelector('.preview-img-wrap > .preview-img-reveal'), 4146 title: this.DOM.el.querySelector('.preview-title'), 4147 content: this.DOM.el.querySelector('.preview-content') 4148 }; 4149 4150 // Some config values. 4151 this.config = { 4152 animation: { 4153 duration: 0.6, 4154 ease: Expo.easeOut 4155 } 4156 }; 4157 } 4158 // Sets the current class. 4159 setCurrent(isCurrent = true) { 4160 this.DOM.el.classList[isCurrent ? 'add' : 'remove']('slide-current'); 4161 } 4162 // Hide the slide. 4163 hide(direction) { 4164 return this.toggle('hide', direction); 4165 } 4166 // Show the slide. 4167 show(direction) { 4168 return this.toggle('show', direction); 4169 } 4170 // Show/Hide the slide. 4171 toggle(action, direction) { 4172 // Hide/Show revealer on top of the image and move the image, title and number. 4173 return new Promise((resolve, reject) => { 4174 let revealerOpts = { 4175 delay: action === 'hide' ? 0 : this.config.animation.duration/2, 4176 ease: this.config.animation.ease, 4177 onComplete: resolve 4178 }; 4179 4180 const commonOpts = { 4181 delay: action === 'hide' ? 0 : this.config.animation.duration/2, 4182 ease: this.config.animation.ease, 4183 opacity: action === 'hide' ? 0 : 1 4184 }; 4185 let imgOpts = Object.assign({},commonOpts); 4186 let numberOpts = Object.assign({},commonOpts); 4187 let titleOpts = Object.assign({},commonOpts); 4188 4189 if ( direction === 'left' || direction === 'right' ) { 4190 revealerOpts.startAt = action === 'hide' ? {x: direction === 'left' ? '-100%' : '100%', y:'0%'} : {x: '0%', y:'0%'}; 4191 revealerOpts.x = action === 'hide' ? '0%' : direction === 'left' ? '100%' : '-100%'; 4192 imgOpts.startAt = action === 'show' ? {opacity: 0, x: direction === 'left' ? '-20%' : '20%'} : {}; 4193 imgOpts.x = action === 'hide' ? direction === 'left' ? '20%' : '-20%' : '0%'; 4194 titleOpts.startAt = action === 'show' ? {opacity: 1, scale: 0.2, x: direction === 'left' ? '-200%' : '200%'} : {}; 4195 titleOpts.x = action === 'hide' ? direction === 'left' ? '200%' : '-200%' : '0%'; 4196 titleOpts.scale = action === 'hide' ? 0.2 : 1; 4197 numberOpts.startAt = action === 'show' ? {opacity: 1, x: direction === 'left' ? '-50%' : '50%'} : {}; 4198 numberOpts.x = action === 'hide' ? direction === 'left' ? '50%' : '-50%' : '0%'; 4199 } 4200 else { 4201 revealerOpts.startAt = action === 'hide' ? {x:'0%', y: direction === 'down' ? '-100%' : '100%'} : {x:'0%', y: '0%'}; 4202 revealerOpts.y = action === 'hide' ? '0%' : direction === 'down' ? '100%' : '-100%'; 4203 imgOpts.startAt = action === 'show' ? {opacity: 1, y: direction === 'down' ? '-10%' : '10%'} : {}; 4204 imgOpts.y = action === 'hide' ? direction === 'down' ? '10%' : '-10%' : '0%'; 4205 titleOpts.ease = this.config.animation.ease, 4206 titleOpts.startAt = action === 'show' ? {opacity: 1, y: direction === 'down' ? '-100%' : '100%'} : {}; 4207 titleOpts.y = action === 'hide' ? direction === 'down' ? '100%' : '-100%' : '0%'; 4208 } 4209 4210 // Toggling the revealer. 4211 TweenMax.to(this.DOM.revealer, this.config.animation.duration, revealerOpts); 4212 // Moving & fading the image (wrappper). 4213 TweenMax.to(this.DOM.imgWrap, this.config.animation.duration, imgOpts); 4214 // Moving & fading the title and number. 4215 TweenMax.to(this.DOM.title, this.config.animation.duration*1.5, titleOpts); 4216 TweenMax.to(this.DOM.number, this.config.animation.duration, numberOpts); 4217 }); 4218 } 4219 // Hide the preview element. 4220 hidePreview(delay) { 4221 return this.togglePreview('hide'); 4222 } 4223 // Show the preview element. 4224 showPreview(delay) { 4225 return this.togglePreview('show'); 4226 } 4227 // Show/Hide the preview. 4228 togglePreview(action) { 4229 return new Promise((resolve, reject) => { 4230 // Hide/Show revealer. 4231 TweenMax.to(this.DOM.preview.revealer, this.config.animation.duration, { 4232 delay: action === 'hide' ? 0 : this.config.animation.duration/2, 4233 ease: this.config.animation.ease, 4234 startAt: action === 'hide' ? {x:'0%', y:'-100%'} : {x:'0%', y:'0%'}, 4235 y: action === 'hide' ? '0%' : '-100%', 4236 onComplete: resolve 4237 }); 4238 // Move and fade the image wrapper. 4239 TweenMax.to(this.DOM.preview.imgWrap, this.config.animation.duration, { 4240 delay: action === 'hide' ? 0 : this.config.animation.duration/2, 4241 ease: this.config.animation.ease, 4242 startAt: action === 'hide' ? {} : {opacity: 0, y: '20%'}, 4243 y: action === 'hide' ? '20%' : '0%', 4244 opacity: action === 'hide' ? 0 : 1 4245 }); 4246 // Move and fade the title and content. 4247 TweenMax.to([this.DOM.preview.title,this.DOM.preview.content], this.config.animation.duration, { 4248 delay: action === 'hide' ? 0 : this.config.animation.duration/2, 4249 ease: this.config.animation.ease, 4250 startAt: action === 'hide' ? {} : {opacity: 0, y: '200%'}, 4251 y: action === 'hide' ? '200%' : '0%', 4252 opacity: action === 'hide' ? 0 : 1 4253 }); 4254 }); 4255 } 4256 } 4257 4258 // The Slideshow class. 4259 class Slideshow { 4260 constructor(el) { 4261 this.DOM = {el: el}; 4262 // Navigation controls (prev, next and preview ctrls) 4263 this.DOM.prevCtrl = this.DOM.el.querySelector('.slidenav-item--prev'); 4264 this.DOM.nextCtrl = this.DOM.el.querySelector('.slidenav-item--next'); 4265 this.DOM.previewCtrl = this.DOM.el.querySelector('.slidenav-preview'); 4266 // The slides. 4267 this.slides = []; 4268 Array.from(this.DOM.el.querySelectorAll('.slide')).forEac
4268h(slideEl => this.slides.push(new Slide(slideEl))); 4269 // The total number of slides. 4270 this.slidesTotal = this.slides.length; 4271 // Current slide position. 4272 this.current = 0; 4273 // initialize the slideshow. 4274 this.init(); 4275 } 4276 // init: set the current slide and initialize some events.. 4277 init() { 4278 this.slides[this.current].setCurrent(); 4279 this.initEvents(); 4280 } 4281 initEvents() { 4282 this.DOM.prevCtrl.addEventListener('click', () => this.prev()); 4283 this.DOM.nextCtrl.addEventListener('click', () => this.next()); 4284 this.DOM.previewCtrl.addEventListener('click', (ev) => { 4285 if ( this.isAnimating ) return; 4286 if ( ev.target.classList.contains('slidenav-preview--open') ) { 4287 ev.target.classList.remove('slidenav-preview--open'); 4288 this.exitPreview(); 4289 } 4290 else { 4291 ev.target.classList.add('slidenav-preview--open') 4292 this.enterPreview(); 4293 } 4294 }); 4295 } 4296 prev() { 4297 this.navigate('left'); 4298 } 4299 next() { 4300 this.navigate('right'); 4301 } 4302 enterPreview() { 4303 this.togglePreview('enter'); 4304 } 4305 exitPreview() { 4306 this.togglePreview('exit'); 4307 } 4308 togglePreview(action) { 4309 // If animating return. 4310 if ( this.isAnimating ) return; 4311 this.isAnimating = true; 4312 4313 const processing = action === 'enter' ? 4314 [this.slides[this.current].hide('up'), this.slides[this.current].showPreview()] : 4315 [this.slides[this.current].show('down'), this.slides[this.current].hidePreview()]; 4316 4317 // Hide the next/prev controls. 4318 this.toggleNavCtrls(action); 4319 4320 Promise.all(processing).then(() => this.isAnimating = false); 4321 } 4322 toggleNavCtrls(action) { 4323 TweenMax.to([this.DOM.prevCtrl, this.DOM.nextCtrl], 0.5, { 4324 ease: 'Expo.easeOut', 4325 opacity: action === 'enter' ? 0 : 1, 4326 onStart: () => this.DOM.prevCtrl.style.pointerEvents = this.DOM.nextCtrl.style.pointerEvents = action === 'enter' ? 'none' : 'auto' 4327 }); 4328 } 4329 // Navigate the slideshow. 4330 navigate(direction) { 4331 // If animating return. 4332 if ( this.isAnimating ) return; 4333 this.isAnimating = true; 4334 4335 const nextSlidePos = direction === 'right' ? 4336 this.current < this.slidesTotal-1 ? this.current+1 : 0 : 4337 this.current > 0 ? this.current-1 : this.slidesTotal-1; 4338 4339 Promise.all([this.slides[this.current].hide(direction), this.slides[nextSlidePos].show(direction)]) 4340 .then(() => { 4341 // Update current. 4342 this.slides[this.current].setCurrent(false); 4343 this.current = nextSlidePos; 4344 this.isAnimating = false; 4345 this.slides[this.current].setCurrent(); 4346 }); 4347 } 4348 } 4349 4350 const slideshow = new Slideshow(document.querySelector('.motion-reveal-slider-wrapper.slideshow')); 4351 } ); 4352 //End execute javascript for motion reveal slider 4353 4354 4355 //Start execute javascript for testimonials card 4356 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-testimonial-card.default', function( $scope ) { 4357 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {return typeof obj;} : function (obj) {return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;};(function ($) { 4358 $.extend({ 4359 Mod2Slider: function Mod2Slider(options) { 4360 4361 // make sure either an object with all of our options is passed in or nothing at all 4362 if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) !== 'object') { 4363 throw new Error('Invalid parameter. You must pass in an object!'); 4364 } else { 4365 4366 /** 4367 * Setup all of our options 4368 * 4369 * 1. NameSpace is going to to be the id of the main section containing the slider. If nothing is passed in then the body tag will be used as the namespace, meaning if you have more than one slider on the page then only the first will be found. 4370 * 2. beginningSlide is going to be which slide you want the slider to start out on, first, middle, or last. 4371 * 3. slideDirection sets the slider to be either horizontal or vertical 4372 * 4. overflow sets the css overflow property of the slider ul. If overflow is hidden then only the active slide will be visible, else if overflow is set to visible then all the slides will be visible in a row. 4373 * 5. bulletNav takes in a boolean that if true appends a bullet list nav to the slider. 4374 * 6. navigateBySlide takes in a boolen that if true allows users to navigate to a slide by clicking on it. 4375 * 4376 */ 4377 4378 var nameSpace = options.sectionId || 'body .testimonials-card-wrapper'; 4379 var beginningSlide = options.beginningSlide || 'second'; 4380 var sliderDirection = options.sliderDirection || 'horizontal'; 4381 var overflow = options.overflow || 'hidden'; 4382 var bulletNav = options.bulletNav;
4383 var navigateBySlide = options.navigateBySlide || false; 4384 var positionUnit = options.positionUnit || 'px'; 4385 4386 // cache frequently called dom elements 4387 var slides = jQuery(nameSpace + ' .slider li'); 4388 var sliderUl = jQuery(nameSpace + ' .slider > ul'); 4389 var sliderContainer = jQuery(nameSpace + ' .slider'); 4390 var sliderNav = void 0; 4391 var sliderNavBtns = void 0; 4392 var direction = void 0; 4393 4394 // initialize slider 4395 var initSlider = function initSlider() { 4396 // set which slide to start on 4397 var x = void 0; 4398 4399 switch (beginningSlide) { 4400 case 'first': 4401 x = 0; 4402 break; 4403 case 'second': 4404 x = 1; 4405 break; 4406 case 'middle': 4407 x = Math.floor(slides.length / 2); 4408 break; 4409 case 'last': 4410 x = slides.length - 1; 4411 break;} 4412 4413 4414 // give slides a data attribute containing their index number 4415 jQuery(slides).each(function (i) { 4416 jQuery(this).attr('data', i); 4417 }); 4418 4419 // style slider and position slides 4420 styleSlider(); 4421 positionSlides(x); 4422 4423 // initialize slider nav if bulletNav true 4424 if (bulletNav) { 4425 sliderNavInit(x); 4426 } 4427 4428 // initialize the click listener function for slides if navigateBySlide is true 4429 if (navigateBySlide) { 4430 jQuery(slides).hover().css({ 4431 cursor: 'pointer' }); 4432 4433 slideListener(); 4434 } 4435 4436 }; 4437 4438 // setup necessary styles for the slider, this is called when first initializing 4439 var styleSlider = function styleSlider() { 4440 /** 4441 * Set the height of the slider to the height of the tallest slide. 4442 * This is done to avoid the slider pushing or pulling the elements below it during a slide transition. 4443 */ 4444 var slideHeights = []; 4445 jQuery(slides).each(function () { 4446 slideHeights.push(jQuery(this).outerHeight()); 4447 }); 4448 4449 jQuery(sliderUl).css('min-height', Math.max.apply(Math, slideHeights)); 4450 4451 // set the overflow of the slider 4452 sliderUl.css('overflow', overflow); 4453 4454 // set the direction of the slider 4455 if (sliderDirection === 'vertical') { 4456 direction = 'top'; 4457 } else if (sliderDirection === 'horizontal') { 4458 direction = 'left'; 4459 } 4460 }; 4461 4462 // position slides, takes in an integer which indicates the slide index to make active 4463 var positionSlides = function positionSlides(index) { 4464 4465 // check to make sure the index parameter is valid 4466 if (index < 0 || index > slides.length) { 4467 throw new Error('Invalid index parameter.'); 4468 return; 4469 } else { 4470 var activeSlide = jQuery(slides[index]); 4471 var fullSlideWidth = jQuery(slides[index]).outerWidth(true); 4472 var unitCalc = void 0; 4473 4474 if (positionUnit === 'px') { 4475 unitCalc = fullSlideWidth; 4476 } else if (positionUnit === '%') { 4477 unitCalc = 100; 4478 } 4479 4480 // set the slider ul to the active slide width 4481 jQuery(sliderUl).css('width', fullSlideWidth); 4482 4483 // set the position of the active slide and all previous + next slides 4484 activeSlide.css(direction, '0'); 4485 4486 activeSlide.prevAll().each(function (i) { 4487 jQuery(this).css(direction, '-' + unitCalc * (i + 1) + positionUnit); 4488 }); 4489 4490 activeSlide.nextAll().each(function (i) { 4491 jQuery(this).css(direction, unitCalc * (i + 1) + positionUnit); 4492 }); 4493 } 4494 }; 4495 4496 // initialize the slider nav, takes in an integer which indicates the current active slide 4497 var sliderNavInit = function sliderNavInit(x) { 4498 // append nav to slider and save the reference to sliderNav variable 4499 sliderContainer.append('<nav class="slider-nav"><ul></ul></nav>'); 4500 sliderNav = jQuery(nameSpace + ' .slider-nav'); 4501
4502 // append an li for each slide to the slider nav ul 4503 for (var i = 0; i < slides.length; i++) { 4504 if (i < x || i > x) { 4505 jQuery(sliderNav).find('ul').append('<li class="bullet" data="' + i + '"></li>'); 4506 } else if (i === x) { 4507 jQuery(sliderNav).find('ul').append('<li class="active-bullet bullet" data="' + i + '"></li>'); 4508 } 4509 } 4510 4511 // save reference to nav btns in a varible 4512 sliderNavBtns = jQuery(nameSpace + ' li[class*="bullet"]'); 4513 4514 // call the click handeler function 4515 navListener(); 4516 }; 4517 4518 // navigate to slide when clicking on nav bullets 4519 var navListener = function navListener() { 4520 sliderNav.click(function (e) { 4521 4522 // we only care about clicks on the li's 4523 if (e.target.tagName === 'LI') { 4524 4525 // get the value of the data attribute from the clicked li and conver to an integer 4526 var index = parseInt(jQuery(e.target).attr('data')); 4527 4528 // style active button 4529 sliderNavBtns.each(function () { 4530 jQuery(this).removeClass('active-bullet'); 4531 }); 4532 4533 jQuery(e.target).addClass('active-bullet'); 4534 4535 // position the slides 4536 positionSlides(index); 4537 } 4538 }); 4539 }; 4540 4541 // called if navigateBySlide is true 4542 var slideListener = function slideListener() { 4543 sliderContainer.click(function (e) { 4544 4545 // filter out clicks that are on the container 4546 //var slideClicked = e.target.tagName !== 'DIV' ? true : false; 4547 4548 //if (slideClicked) { 4549 // get the data attribute value of the clicked li and convert to an integer 4550 var index = parseInt(jQuery(e.target).closest('li').attr('data')); 4551 4552 // if a bullet nav exists, update the button styles 4553 if (sliderNav) { 4554 sliderNavBtns.each(function () { 4555 jQuery(this).removeClass('active-bullet'); 4556 }); 4557 4558 jQuery(sliderNavBtns[index]).addClass('active-bullet'); 4559 } 4560 4561 // position the slides 4562 positionSlides(index); 4563 //} 4564 }); 4565 }; 4566 4567 initSlider(); 4568 } 4569 4570 } }); 4571 4572 })(jQuery); 4573 4574 jQuery(".testimonials-card-wrapper").each(function() { 4575 var slideshow = jQuery(this).parent('.elementor-widget-container').parent('.elementor-widget-avante-testimonial-card'); 4576 var slideshowNameSpace = '#'+slideshow.attr('data-id')+' .testimonials-card-wrapper'; 4577 var slideshowBeginningSlide = jQuery(this).attr('data-beginning-slide'); 4578 var slideshowPagination = jQuery(this).attr('data-pagination'); 4579 4580 new $.Mod2Slider({ 4581 nameSpace: slideshowNameSpace, 4582 beginningSlide: slideshowBeginningSlide, 4583 bulletNav: Boolean(Number(slideshowPagination)), 4584 overflow: 'visible', 4585 navigateBySlide: true, 4586 positionUnit: 'px' }); 4587 } ); 4588 }); 4589 //End execute javascript for testimonials card 4590 4591 4592 //Start execute javascript for slider image carousel 4593 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-image-carousel.default', function( $scope ) { 4594 jQuery(".image-carousel-slider-wrapper").each(function() { 4595 jQuery(this).find('.carousel-item').eq(0).addClass('active'); 4596 var total = jQuery(this).find('.carousel-item').length; 4597 var current = 0; 4598 var slideObj = jQuery(this); 4599 4600 jQuery(this).find('#moveRight').on('click', function(){ 4601 var next=current; 4602 current= current+1; 4603 setSlide(next, current, slideObj); 4604 }); 4605 jQuery(this).find('#moveLeft').on('click', function(){ 4606 var prev=current; 4607 current = current- 1; 4608 setSlide(prev, current, slideObj); 4609 }); 4610 function setSlide(prev, next, slideObj){ 4611 var slide= current; 4612 if(next>total-1){ 4613 slide=0; 4614 current=0; 4615 } 4616 if(next<0){ 4617 slide=total - 1; 4618 current=total - 1; 4619 } 4620 4621 slideObj.find('.carousel-item').eq(prev).removeClass('active'); 4622 slideObj.find('.carousel-item').eq(slide).addClass('active'); 4623 setTimeout(function(){ 4624 4625 },800); 4626 } 4627 }); 4628 } ); 4629 //End execute javascript for slider image carousel
4630 4631 4632 //Start execute javascript for portfolio grid 4633 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-grid.default', function( $scope ) { 4634 jQuery(".portfolio_grid_container").each(function() { 4635 var containderDiv = jQuery(this); 4636 var selectedClass = ""; 4637 4638 containderDiv.find(".filter-tag-btn").on('click', function(){ 4639 containderDiv.find(".filter-tag-btn").removeClass("active"); 4640 jQuery(this).addClass("active"); 4641 selectedClass = jQuery(this).attr("data-rel"); 4642 column = jQuery(this).attr("data-cols"); 4643 4644 var gridDiv = containderDiv.find(".portfolio-grid-content-wrapper"); 4645 4646 gridDiv.fadeTo(100, 0); 4647 gridDiv.find(".portfolio-grid-wrapper").css({ 4648 opacity: 0, 4649 display: 'none', 4650 transform: 'scale(0.0)' 4651 }); 4652 gridDiv.find(".portfolio-grid-wrapper").not("."+selectedClass).fadeOut().removeClass('scale-anm'); 4653 4654 setTimeout(function() { 4655 jQuery("."+selectedClass).fadeIn().addClass('scale-anm'); 4656 4657 jQuery("."+selectedClass).css({ 4658 opacity: 1, 4659 display: 'block', 4660 transform: 'scale(1,1)' 4661 }); 4662 4663 gridDiv.find(".portfolio-grid-wrapper.last").removeClass('last'); 4664 var count = gridDiv.find(".portfolio-grid-wrapper.scale-anm").length; 4665 4666 gridDiv.find(".portfolio-grid-wrapper.scale-anm").each(function(index){ 4667 var lastIndex = parseInt(index+1); 4668 4669 if(lastIndex%column == 0) 4670 { 4671 jQuery(this).addClass('last'); 4672 } 4673 4674 if(lastIndex == count) 4675 { 4676 setTimeout(function() { 4677 gridDiv.fadeTo(300, 1); 4678 }, 300); 4679 } 4680 }); 4681 4682 }, 300); 4683 }); 4684 }); 4685 } ); 4686 //End execute javascript for portfolio grid 4687 4688 4689 4690 //Start execute javascript for portfolio grid overlay 4691 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-grid-overlay.default', function( $scope ) { 4692 jQuery(".portfolio-grid-overlay-container").each(function() { 4693 var containderDiv = jQuery(this); 4694 var selectedClass = ""; 4695 4696 containderDiv.find(".portfolio-grid-wrapper-overlay").imagesLoaded().always( function() { 4697 var currentWrapper = containderDiv.find(".portfolio-grid-wrapper-overlay"); 4698 var currentImg = containderDiv.find(".portfolio-grid-wrapper-overlay img"); 4699 4700 currentWrapper.css('height', currentImg.height()+'px'); 4701 }); 4702 4703 jQuery(window).resize(function() { 4704 containderDiv.find(".portfolio-grid-wrapper-overlay").each(function() { 4705 var currentImg = jQuery(this).find("img"); 4706 4707 jQuery(this).css('height', currentImg.height()+'px'); 4708 }); 4709 }); 4710 4711 containderDiv.find(".filter-tag-btn").on('click', function(){ 4712 containderDiv.find(".filter-tag-btn").removeClass("active"); 4713 jQuery(this).addClass("active"); 4714 selectedClass = jQuery(this).attr("data-rel"); 4715 column = jQuery(this).attr("data-cols"); 4716 4717 var gridDiv = containderDiv.find(".portfolio-grid-content-wrapper"); 4718 4719 gridDiv.fadeTo(100, 0); 4720 gridDiv.find(".portfolio-grid-wrapper-overlay").css({ 4721 opacity: 0, 4722 display: 'none', 4723 transform: 'scale(0.0)' 4724 }); 4725 gridDiv.find(".portfolio-grid-wrapper-overlay").not("."+selectedClass).fadeOut().removeClass('scale-anm'); 4726 4727 setTimeout(function() { 4728 jQuery("."+selectedClass).fadeIn().addClass('scale-anm'); 4729 4730 jQuery("."+selectedClass).css({ 4731 opacity: 1, 4732 display: 'block', 4733 transform: 'scale(1,1)' 4734 }); 4735 4736 gridDiv.find(".portfolio-grid-wrapper-overlay.last").removeClass('last'); 4737 var count = gridDiv.find(".portfolio-grid-wrapper-overlay.scale-anm").length; 4738 4739 gridDiv.find(".portfolio-grid-wrapper-overlay.scale-anm").each(function(index){ 4740 var lastIndex = parseInt(index+1); 4741 if(lastIndex%column == 0) 4742 { 4743 jQuery(this).addClass('last'); 4744 } 4745 4746 if(lastIndex == count) 4747 { 4748 setTimeout(function() { 4749 gridDiv.fadeTo(300, 1); 4750 }, 300); 4751 } 4752 }); 4753 4754 }, 300); 4755 }); 4756 }); 4757 } ); 4758 //End execute javascript for portfolio grid overlay 4759 4760 4761 //Start execute javascript for portfolio grid overlay 3d 4762 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-3d-overlay.default', function( $scope ) {
4763 jQuery(".portfolio-grid-overlay-container").each(function() { 4764 var containderDiv = jQuery(this); 4765 var selectedClass = ""; 4766 4767 containderDiv.find(".portfolio-grid-wrapper-overlay").imagesLoaded().always( function() { 4768 var currentWrapper = containderDiv.find(".portfolio-grid-wrapper-overlay"); 4769 var currentImg = containderDiv.find(".portfolio-grid-wrapper-overlay img"); 4770 4771 currentWrapper.css('height', currentImg.height()+'px'); 4772 }); 4773 4774 jQuery(window).resize(function() { 4775 containderDiv.find(".portfolio-grid-wrapper-overlay").each(function() { 4776 var currentImg = jQuery(this).find("img"); 4777 4778 jQuery(this).css('height', currentImg.height()+'px'); 4779 }); 4780 }); 4781 4782 if(!is_touch_device()) 4783 { 4784 var scaleTilt = 1.15; 4785 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 4786 scaleTilt = 1; 4787 } 4788 4789 containderDiv.find(".grid_tilt").tilt({ 4790 scale: scaleTilt, 4791 perspective: 2000, 4792 glare: true, 4793 maxGlare: .5 4794 }); 4795 } 4796 if(!elementorFrontend.isEditMode()) 4797 { 4798 containderDiv.find(".portfolio-grid-wrapper-overlay").on('click', function(){ 4799 window.location = jQuery(this).find("a").first().attr("href"); 4800 }); 4801 } 4802 4803 containderDiv.find(".filter-tag-btn").on('click', function(){ 4804 containderDiv.find(".filter-tag-btn").removeClass("active"); 4805 jQuery(this).addClass("active"); 4806 selectedClass = jQuery(this).attr("data-rel"); 4807 column = jQuery(this).attr("data-cols"); 4808 4809 var gridDiv = containderDiv.find(".portfolio-grid-content-wrapper"); 4810 4811 gridDiv.fadeTo(100, 0); 4812 gridDiv.find(".portfolio-grid-wrapper-overlay").css({ 4813 opacity: 0, 4814 display: 'none', 4815 transform: 'scale(0.0)' 4816 }); 4817 gridDiv.find(".portfolio-grid-wrapper-overlay").not("."+selectedClass).fadeOut().removeClass('scale-anm'); 4818 4819 setTimeout(function() { 4820 jQuery("."+selectedClass).fadeIn().addClass('scale-anm'); 4821 4822 jQuery("."+selectedClass).css({ 4823 opacity: 1, 4824 display: 'block', 4825 transform: 'scale(1,1)' 4826 }); 4827 4828 gridDiv.find(".portfolio-grid-wrapper-overlay.last").removeClass('last'); 4829 var count = gridDiv.find(".portfolio-grid-wrapper-overlay.scale-anm").length; 4830 4831 gridDiv.find(".portfolio-grid-wrapper-overlay.scale-anm").each(function(index){ 4832 var lastIndex = parseInt(index+1); 4833 if(lastIndex%column == 0) 4834 { 4835 jQuery(this).addClass('last'); 4836 } 4837 4838 if(lastIndex == count) 4839 { 4840 setTimeout(function() { 4841 gridDiv.fadeTo(300, 1); 4842 }, 300); 4843 } 4844 }); 4845 4846 }, 300); 4847 }); 4848 }); 4849 } ); 4850 //End execute javascript for portfolio grid overlay 3d 4851 4852 4853 //Start execute javascript for portfolio classic 4854 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-classic.default', function( $scope ) { 4855 jQuery(".portfolio-classic-container").each(function() { 4856 var containderDiv = jQuery(this); 4857 var selectedClass = ""; 4858 4859 containderDiv.find(".filter-tag-btn").on('click', function(){ 4860 containderDiv.find(".filter-tag-btn").removeClass("active"); 4861 jQuery(this).addClass("active"); 4862 selectedClass = jQuery(this).attr("data-rel"); 4863 column = jQuery(this).attr("data-cols"); 4864 4865 var gridDiv = containderDiv.find(".portfolio-classic-content-wrapper"); 4866 4867 gridDiv.fadeTo(100, 0); 4868 gridDiv.find(".portfolio-classic-grid-wrapper").css({ 4869 opacity: 0, 4870 display: 'none', 4871 transform: 'scale(0.0)' 4872 }); 4873 gridDiv.find(".portfolio-classic-grid-wrapper").not("."+selectedClass).fadeOut().removeClass('scale-anm'); 4874 4875 setTimeout(function() { 4876 jQuery("."+selectedClass).addClass('scale-anm'); 4877 4878 jQuery("."+selectedClass).css({ 4879 opacity: 1, 4880 display: 'block', 4881 transform: 'scale(1,1)' 4882 }); 4883 4884 gridDiv.find(".portfolio-classic-grid-wrapper.last").removeClass('last');
4885 var count = gridDiv.find(".portfolio-classic-grid-wrapper.scale-anm").length; 4886 4887 gridDiv.find(".portfolio-classic-grid-wrapper.scale-anm").each(function(index){ 4888 var lastIndex = parseInt(index+1); 4889 if(lastIndex%column == 0) 4890 { 4891 jQuery(this).addClass('last'); 4892 } 4893 4894 if(lastIndex == count) 4895 { 4896 setTimeout(function() { 4897 gridDiv.fadeTo(300, 1); 4898 }, 300); 4899 } 4900 }); 4901 4902 }, 300); 4903 }); 4904 }); 4905 } ); 4906 //End execute javascript for portfolio classic 4907 4908 4909 //Start execute javascript for portfolio contain 4910 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-contain.default', function( $scope ) { 4911 jQuery(".portfolio-classic-container.contain").each(function() { 4912 var containderDiv = jQuery(this); 4913 var selectedClass = ""; 4914 4915 containderDiv.find(".filter-tag-btn").on('click', function(){ 4916 containderDiv.find(".filter-tag-btn").removeClass("active"); 4917 jQuery(this).addClass("active"); 4918 selectedClass = jQuery(this).attr("data-rel"); 4919 column = jQuery(this).attr("data-cols"); 4920 4921 var gridDiv = containderDiv.find(".portfolio-classic-content-wrapper"); 4922 4923 gridDiv.fadeTo(100, 0); 4924 gridDiv.find(".portfolio-classic-grid-wrapper").css({ 4925 opacity: 0, 4926 display: 'none', 4927 transform: 'scale(0.0)' 4928 }); 4929 gridDiv.find(".portfolio-classic-grid-wrapper").not("."+selectedClass).fadeOut().removeClass('scale-anm'); 4930 4931 setTimeout(function() { 4932 jQuery("."+selectedClass).addClass('scale-anm'); 4933 4934 jQuery("."+selectedClass).css({ 4935 opacity: 1, 4936 display: 'block', 4937 transform: 'scale(1,1)' 4938 }); 4939 4940 gridDiv.find(".portfolio-classic-grid-wrapper.last").removeClass('last'); 4941 var count = gridDiv.find(".portfolio-classic-grid-wrapper.scale-anm").length; 4942 4943 gridDiv.find(".portfolio-classic-grid-wrapper.scale-anm").each(function(index){ 4944 var lastIndex = parseInt(index+1); 4945 if(lastIndex%column == 0) 4946 { 4947 jQuery(this).addClass('last'); 4948 } 4949 4950 if(lastIndex == count) 4951 { 4952 setTimeout(function() { 4953 gridDiv.fadeTo(300, 1); 4954 }, 300); 4955 } 4956 }); 4957 4958 }, 300); 4959 }); 4960 }); 4961 } ); 4962 //End execute javascript for portfolio contain 4963 4964 4965 //Start execute javascript for navigation menu 4966 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-navigation-menu.default', function( $scope ) { 4967 jQuery('.themegoods-navigation-wrapper .nav li.menu-item').hover(function() 4968 { 4969 jQuery(this).children('ul:first').addClass('visible'); 4970 jQuery(this).children('ul:first').addClass('hover'); 4971 }, 4972 function() 4973 { 4974 jQuery(this).children('ul:first').removeClass('visible'); 4975 jQuery(this).children('ul:first').removeClass('hover'); 4976 }); 4977 4978 jQuery('.themegoods-navigation-wrapper .nav li.menu-item').children('ul:first.hover').hover(function() 4979 { 4980 jQuery(this).stop().addClass('visible'); 4981 }, 4982 function() 4983 { 4984 jQuery(this).stop().removeClass('visible'); 4985 }); 4986 } ); 4987 //End execute javascript for navigation menu 4988 4989 4990 //Start execute javascript for video grid 4991 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-video-grid.default', function( $scope ) { 4992 jQuery(".portfolio-classic-container.video-grid").each(function() { 4993 var containerDiv = jQuery(this); 4994 var selectedClass = ""; 4995 4996 containerDiv.find(".filter-tag-btn").on('click', function(){ 4997 containerDiv.find(".filter-tag-btn").removeClass("active"); 4998 jQuery(this).addClass("active"); 4999 selectedClass = jQuery(this).attr("data-rel"); 5000 column = jQuery(this).attr("data-cols"); 5001 5002 var gridDiv = containerDiv.find(".portfolio-classic-content-wrapper.video-grid"); 5003 gridDiv.fadeTo(100, 0); 5004 gridDiv.find(".portfolio-classic-grid-wrapper").not("."+selectedClass).fadeOut().removeClass('scale-anm'); 5005 5006 setTimeout(function() { 5007 jQuery("."+selectedClass).fadeIn().addClass('scale-anm');
5008 gridDiv.find(".portfolio-classic-grid-wrapper.last").removeClass('last'); 5009 var count = gridDiv.find(".portfolio-classic-grid-wrapper.scale-anm").length; 5010 5011 gridDiv.find(".portfolio-classic-grid-wrapper.scale-anm").each(function(index){ 5012 var lastIndex = parseInt(index+1); 5013 if(lastIndex%column == 0) 5014 { 5015 jQuery(this).addClass('last'); 5016 } 5017 5018 if(lastIndex == count) 5019 { 5020 setTimeout(function() { 5021 gridDiv.fadeTo(300, 1); 5022 }, 300); 5023 } 5024 }); 5025 5026 }, 300); 5027 }); 5028 }); 5029 5030 5031 jQuery(".portfolio-classic-content-wrapper.video-grid .video-grid-wrapper").each(function() { 5032 var video = this.getElementsByClassName("video-card")[0]; 5033 var id = jQuery(video).data('video-id'); 5034 5035 var play = document.createElement("div"); 5036 var outline = document.createElement("div"); 5037 var ring = document.createElement("div"); 5038 var fill = document.createElement("div"); 5039 var mask = document.createElement("div"); 5040 var wipe = document.createElement("div"); 5041 var wrap = document.createElement("div"); 5042 var iframe = '<iframe width="100%" height="100%" src="https://www.youtube.com/embed/'+id+'" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>'; 5043 5044 TweenMax.set(play, { 5045 css:{ 5046 width: 0, 5047 height: 0, 5048 "border-top": "10px solid transparent", 5049 "border-bottom": "10px solid transparent", 5050 "border-left": "14px solid white", 5051 "z-index": 50, 5052 position: 'absolute', 5053 top: "50%", 5054 left: "50%", 5055 marginLeft: "-4px", 5056 marginTop: "-9px" 5057 } 5058 }); 5059 TweenMax.set(outline, { 5060 css:{ 5061 width: 65, 5062 height: 65, 5063 border: "3px solid white", 5064 "border-radius": "999px", 5065 "z-index": 50, 5066 position: 'absolute', 5067 top: "50%", 5068 left: "50%", 5069 y: "-50%", 5070 x: "-50%" 5071 } 5072 }); 5073 TweenMax.set(ring, { 5074 css:{ 5075 width: 65, 5076 height: 65, 5077 border: "1px solid white", 5078 "border-radius": "999px", 5079 "z-index": 50, 5080 position: 'absolute', 5081 top: "50%", 5082 left: "50%", 5083 y: "-50%", 5084 x: "-50%" 5085 } 5086 }); 5087 TweenMax.set(fill, { 5088 css:{ 5089 width: 65, 5090 opacity: 0, 5091 height: 65, 5092 "background-color": "white", 5093 "border-radius": "999px", 5094 "z-index": 50, 5095 position: 'absolute', 5096 top: "50%", 5097 left: "50%", 5098 y: "-50%", 5099 x: "-50%" 5100 } 5101 }); 5102 TweenMax.set(mask, { 5103 css:{ 5104 width: 600, 5105 height: 600, 5106 scale: 1, 5107 opacity: 0, 5108 backgroundColor: "#fff", 5109 "border-radius": "300px", 5110 "z-index": 51, 5111 position: 'absolute', 5112 top: "50%", 5113 left: "50%", 5114 y: "-50%", 5115 x: "-50%" 5116 } 5117 }); 5118 TweenMax.set(wipe, { 5119 css:{ 5120 width: "100%", 5121 height: "100%", 5122 opacity: 0, 5123 backgroundColor: "#fff", 5124 "z-index": 53, 5125 position: 'absolute', 5126 top: "0", 5127 right: "0" 5128 } 5129 }); 5130 TweenMax.set(wrap, { 5131 css:{ 5132 width: "100%", 5133 height: "100%", 5134 autoAlpha: 0, 5135 "z-index": 52, 5136 position: 'absolute', 5137 top: "0", 5138 left: "0" 5139 } 5140 }); 5141 5142 video.appendChild(play); 5143 video.appendChild(outline); 5144 video.appendChild(ring); 5145 video.appendChild(fill); 5146 video.appendChild(mask); 5147 video.appendChild(wipe); 5148 jQuery(wrap).html(iframe); 5149 video.appendChild(wrap); 5150 5151 5152 5153 jQuery(video).on("mouseenter", function(event) { 5154 TweenLite.killTweensOf([fill, outline, ring]); 5155 TweenLite.to(fill, 0.4, {opacity: 0.2, ease:"cubic-bezier(0.39, 0.575, 0.565, 1)"}); 5156 TweenLite.to(outline, 0.4, {scale: 0.9, ease:"cubic-bezier(0.39, 0.575, 0.565, 1)"}); 5157 TweenLite.fromTo(ring, 0.7, { 5158 scale: 1, 5159 opacity: 0.5 5160 }, 5161 { 5162 scale: 2, 5163 opacity: 0, 5164 ease:"cubic-bezier(0.165, 0.84, 0.44, 1)" 5165 }); 5166 TweenLite.to(play, 0.2, { 5167 x: 8, 5168 opacity: 0, 5169 ease: "cubic-bezier(0.550, 0.055, 0.675, 0.190)", 5170 onComplete: function() { 5171 TweenLite.set(play,{ 5172 x:-12, 5173 onComplete: function() { 5174 TweenLite.to(play, 0.4, { 5175 x: 0, 5176 opacity: 1, 5177 ease: "cubic-bezier(0.215, 0.610, 0.355, 1.000)", 5178 }); 5179 } 5180 }); 5181 } 5182 }); 5183 }); 5184 5185 jQuery(video).on("mouseleave", function(event) { 5186 TweenLite.killTweensOf([fill, outline]); 5187 TweenLite.to(fill, 0.4, {opacity: 0, ease:"cubic-bezier(0.39, 0.575, 0.565, 1)"}); 5188 TweenLite.to(outline, 0.4, {scale: 1, ease:"cubic-bezier(0.39, 0.575, 0.565, 1)"}); 5189 5190 }); 5191 5192 jQuery(video).on("click", function(event) { 5193 event.preventDefault(); 5194 5195 TweenLite.fromTo(mask, 0.35, { 5196 opacity: 1, 5197 scale: 0 5198 }, 5199 { 5200 scale: 1, 5201 ease: "cubic-bezier(0.550, 0.055, 0.675, 0.190)", 5202 onComplete: function() { 5203 TweenLite.set(mask, { 5204 opacity: 0, 5205 scale: 0, 5206 delay: 0.5, 5207 onComplete: function() { 5208 TweenLite.fromTo(wipe, 0.4, { 5209 width: "100%", 5210 },{ 5211 width: 0, 5212 ease: "cubic-bezier(.42,0,.58,1)" 5213 }); 5214 } 5215 }); 5216 5217 TweenLite.set(wipe, { 5218 opacity: 1, 5219 }); 5220 5221 TweenLite.set(wrap, { 5222 autoAlpha: 1, 5223 }); 5224 5225 } 5226 }); 5227 5228 5229 }); 5230 }); 5231 } ); 5232 //End execute javascript for video grid 5233 5234 //Start execute javascript for portfolio coverflow 5235 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-portfolio-coverflow.default', function( $scope ) { 5236 5237 jQuery(".portfolio-coverflow").each(function() { 5238 var initialSlide = 0;
5239 initialSlide = parseInt(jQuery(this).attr('data-initial') - 1); 5240 5241 var coverflowSwiper = new Swiper(jQuery(this), { 5242 effect: 'coverflow', 5243 grabCursor: true, 5244 centeredSlides: true, 5245 slidesPerView: 'auto', 5246 coverflowEffect: { 5247 rotate: 50, 5248 stretch: 0, 5249 depth: 100, 5250 modifier: 1, 5251 slideShadows : true, 5252 }, 5253 keyboard: { 5254 enabled: true, 5255 onlyInViewport: false, 5256 }, 5257 pagination: { 5258 el: '.swiper-pagination', 5259 }, 5260 initialSlide: initialSlide 5261 }); 5262 }); 5263 5264 } ); 5265 //End execute javascript for portfolio coverflow 5266 5267 //Start execute javascript for glitch slideshow 5268 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-glitch-slideshow.default', function( $scope ) { 5269 class Slide { 5270 constructor(el) { 5271 this.DOM = {el: el}; 5272 this.DOM.slideImg = this.DOM.el.querySelector('.slide-img'); 5273 this.bgImage = this.DOM.slideImg.style.backgroundImage; 5274 this.layout(); 5275 } 5276 layout() { 5277 this.DOM.slideImg.innerHTML = `<div class='glitch-img' style='background-image: ${this.DOM.slideImg.style.backgroundImage};'></div>`.repeat(5); 5278 this.DOM.glitchImgs = Array.from(this.DOM.slideImg.querySelectorAll('.glitch-img')); 5279 } 5280 changeBGImage(bgimage, pos = 0, delay = 0) { 5281 setTimeout(() => this.DOM.glitchImgs[pos].style.backgroundImage = bgimage, delay); 5282 } 5283 } 5284 5285 class GlitchSlideshow { 5286 constructor(el) { 5287 this.DOM = {el: el}; 5288 this.DOM.slides = Array.from(this.DOM.el.querySelectorAll('.slide')); 5289 this.slidesTotal = this.DOM.slides.length; 5290 this.slides = [];
5291 this.DOM.slides.forEach(slide => this.slides.push(new Slide(slide))); 5292 this.current = 0; 5293 this.glitchTime = 1800; 5294 this.totalGlitchSlices = 5; 5295 } 5296 glitch(slideFrom, slideTo) { 5297 return new Promise((resolve, reject) => { 5298 slideFrom.DOM.slideImg.classList.add('glitch--animate'); 5299 5300 const slideFromBGImage = slideFrom.bgImage; 5301 const slideToBGImage = slideTo.bgImage; 5302 5303 for (let i = this.totalGlitchSlices-1; i >= 0; --i) { 5304 slideFrom.changeBGImage(slideToBGImage, i, this.glitchTime/(this.totalGlitchSlices+1)*(this.totalGlitchSlices-i-1) + this.glitchTime/(this.totalGlitchSlices+1)); 5305 } 5306 5307 setTimeout(() => { 5308 slideFrom.DOM.slideImg.classList.remove('glitch--animate'); 5309 5310 // reset bgimages. 5311 for (let i = this.totalGlitchSlices-1; i >= 0; --i) { 5312 slideFrom.changeBGImage(slideFromBGImage, i, 0); 5313 } 5314 5315 resolve(); 5316 }, this.glitchTime); 5317 }); 5318 } 5319 navigate(dir) { 5320 if ( this.isAnimating ) return; 5321 this.isAnimating = true; 5322 5323 const newCurrent = dir === 'next' ? 5324 this.current < this.slidesTotal-1 ? this.current+1 : 0 : 5325 this.current > 0 ? this.current-1 : this.slidesTotal-1; 5326 5327 this.glitch(this.slides[this.current], this.slides[newCurrent]).then(() => { 5328 this.DOM.slides[this.current].classList.remove('slide-current'); 5329 this.current = newCurrent; 5330 this.DOM.slides[this.current].classList.add('slide-current'); 5331 this.isAnimating = false; 5332 }); 5333 } 5334 } 5335 5336 // Preload all the images in the page.. 5337 imagesLoaded(document.querySelectorAll('.slide-img'), {background: true}, () => { 5338 document.body.classList.remove('loading'); 5339 const slideshow = new GlitchSlideshow(document.querySelector('.slides')); 5340 const nav = Array.from(document.querySelectorAll('.slide-nav-button')); 5341 nav[0].addEventListener('click', () => slideshow.navigate('prev')); 5342 nav[1].addEventListener('click', () => slideshow.navigate('next')); 5343 }); 5344 }); 5345 //End execute javascript for glitch slideshow 5346 5347 5348 //Start execute javascript for music player 5349 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-music-player.default', function( $scope ) { 5350 jQuery(".avante-music-player").each(function() { 5351 var containerDiv = jQuery(this); 5352 5353 var songIndex = 0; 5354 var audio = new Audio(); 5355 var $audio = jQuery(audio); 5356 var handleDrag = false; 5357 var timeIn = 0; // only used on mouseup event 5358 5359 var songListID = containerDiv.attr('data-songlist'); 5360 var playlist = JSON.parse(jQuery('#'+songListID).val()); 5361 5362 const $player = containerDiv.find('.player'), 5363 $poster = containerDiv.find('.player-img'), 5364 $background = containerDiv.find('.player-background'), 5365 $title = containerDiv.find('.player-title'), 5366 $artist = containerDiv.find('.player-artist'), 5367 $prev = containerDiv.find('.player-controls__prev'), 5368 $next = containerDiv.find('.player-controls__next'), 5369 $play = containerDiv.find('.player-controls__play'), 5370 $scrubber = containerDiv.find('.player-scrubber'), 5371 $handle = containerDiv.find('.player-scrubber-handle'), 5372 $fill = containerDiv.find('.player-scrubber__fill'), 5373 $time = containerDiv.find('.player-time__played'),
5374 $dur = containerDiv.find('.player-time__duration'); 5375 5376 function time(seconds) { 5377 seconds = Math.floor(seconds); 5378 const mins = Math.floor(seconds / 60); 5379 const secs = seconds % 60; 5380 return mins + ":" + (secs < 10 ? "0": "") + secs; 5381 } 5382 5383 function changeSong(offset, play) { 5384 songIndex += offset; 5385 if(songIndex > playlist.length - 1) songIndex = 0; 5386 if(songIndex < 0) songIndex = playlist.length - 1; 5387 5388 $audio.attr('src', playlist[songIndex].mp3 ); 5389 5390 const src = playlist[songIndex].poster; 5391 5392 $title.text(playlist[songIndex].title); 5393 $artist.text(playlist[songIndex].artist); 5394 5395 $dur.text("-:--");// Until it loads 5396 $audio.on('loadedmetadata', function() { 5397 $dur.text(time(audio.duration)); 5398 setHandle(0, audio.duration); 5399 }); 5400 $audio.on('ended', () => changeSong(+1, true) ); 5401 5402 var img = new Image(); 5403 5404 jQuery(img).attr("src", src) 5405 .on("load", function(){ 5406 5407 $poster.attr('src', src); 5408 $background.css('background-image', 'url("' + src + '")'); 5409 5410 }) 5411 .on("error", function(){ 5412 5413 console.log("Cannot find image"); 5414 5415 }); 5416 5417 if( play ) 5418 { 5419 audio.play(); 5420 $play.find('i').removeClass('fa-play').addClass('fa-pause'); 5421 } 5422 else 5423 { 5424 $play.find('i').removeClass('fa-pause').addClass('fa-play'); 5425 } 5426 5427 } 5428 function setHandle(seconds, duration) { 5429 const percent = seconds/duration*100; 5430 5431 $time.text(time(seconds)); 5432 5433 $handle.css('left', percent + "%"); 5434 $fill.css('width', percent + "%"); 5435 } 5436 5437 $play.click(function(){ 5438 if(audio.currentTime > 0 && !audio.paused) { 5439 audio.pause(); 5440 $play.find('i').removeClass('fa-pause').addClass('fa-play'); 5441 } else { 5442 audio.play(); 5443 $play.find('i').removeClass('fa-play').addClass('fa-pause'); 5444 } 5445 5446 }); 5447 $prev.click(() => changeSong(-1, true) ); 5448 $next.click(() => changeSong(+1, true) ); 5449 5450 5451 $audio.on("timeupdate", () => { 5452 setHandle(audio.currentTime, audio.duration); 5453 }); 5454 5455 $handle.on('mousedown', function() { 5456 handleDrag = true; 5457 audio.pause(); 5458 }); 5459 5460 $player.on('mousemove', function(e) { 5461 5462 if(handleDrag) { 5463 5464 //get percent 5465 const width = $scrubber.width(); 5466 var diff = $scrubber.offset().left - e.clientX; 5467 var percent = -diff / width * 100; 5468 // Limit percent to between 0 and 100 5469 percent = (percent < 0 ? 0 : (percent > 100 ? 100 : percent)); 5470 //convert percent into seconds 5471 var seconds = percent / 100 * audio.duration; 5472 setHandle(seconds, audio.duration); 5473 timeIn = seconds; 5474 5475 } 5476 5477 5478 }) 5479 .on('mouseup mouseleave', function(){ 5480 if(handleDrag) { 5481 handleDrag = false; 5482 audio.currentTime = timeIn; 5483 $play.find('i').removeClass('fa-pause').addClass('fa-play'); 5484 } 5485 }); 5486 5487 5488 // Initialize 5489 changeSong(0, false); 5490 }); 5491 }); 5492 //End execute javascript for music player 5493 5494 //Start execute javascript for mouse driven vertical carousel 5495 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-mouse-driven-vertical-carousel.default', function( $scope ) { 5496 5497 class VerticalMouseDrivenCarousel { 5498 constructor(options = {}) { 5499 const _defaults = { 5500 carousel: ".mouse-driven-vertical-carousel-wrapper .js-carousel", 5501 bgImg: ".js-carousel-bg-img", 5502 list: ".js-carousel-list", 5503 listItem: ".js-carousel-list-item" 5504 }; 5505 5506 this.posY = 0; 5507 5508 this.defaults = Object.assign({}, _defaults, options); 5509 5510 this.initCursor(); 5511 this.init(); 5512 this.bgImgController(); 5513 } 5514 5515 //region getters 5516 getBgImgs() { 5517 return document.querySelectorAll(this.defaults.bgImg); 5518 } 5519 5520 getListItems() { 5521 return document.querySelectorAll(this.defaults.listItem); 5522 } 5523 5524 getList() { 5525 return document.querySelector(this.defaults.list); 5526 } 5527 5528 getCarousel() { 5529 return document.querySelector(this.defaults.carousel); 5530 } 5531 5532 init() { 5533 TweenMax.set(this.getBgImgs(), { 5534 autoAlpha: 0, 5535 scale: 1.05 5536 }); 5537 5538 TweenMax.set(this.getBgImgs()[0], { 5539 autoAlpha: 1, 5540 scale: 1 5541 }); 5542 5543 this.listItems = this.getListItems().length - 1; 5544 5545 this.listOpacityController(0); 5546 } 5547
5548 initCursor() { 5549 //Init only on desktop device 5550 if(jQuery(window).width()>1024) 5551 { 5552 const listHeight = this.getList().clientHeight; 5553 const carouselHeight = this.getCarousel().clientHeight; 5554 const carouselPos = this.getCarousel().getBoundingClientRect(); 5555 const carouselPosY = parseInt(carouselPos.top); 5556 5557 this.getCarousel().addEventListener( 5558 "mousemove", 5559 event => { 5560 this.posY = parseInt(event.pageY - carouselPosY) - this.getCarousel().offsetTop; 5561 let offset = -this.posY / carouselHeight * listHeight; 5562 5563 TweenMax.to(this.getList(), 0.3, { 5564 y: offset, 5565 ease: Power4.easeOut 5566 }); 5567 }, 5568 false 5569 ); 5570 } 5571 } 5572 5573 bgImgController() { 5574 for (const link of this.getListItems()) { 5575 link.addEventListener("mouseenter", ev => { 5576 let currentId = ev.currentTarget.dataset.itemId; 5577 5578 this.listOpacityController(currentId); 5579 5580 TweenMax.to(ev.currentTarget, 0.3, { 5581 autoAlpha: 1 5582 }); 5583 5584 TweenMax.to(".is-visible", 0.2, { 5585 autoAlpha: 0, 5586 scale: 1.05 5587 }); 5588 5589 if (!this.getBgImgs()[currentId].classList.contains("is-visible")) { 5590 this.getBgImgs()[currentId].classList.add("is-visible"); 5591 } 5592 5593 TweenMax.to(this.getBgImgs()[currentId], 0.6, { 5594 autoAlpha: 1, 5595 scale: 1 5596 }); 5597 }); 5598 } 5599 } 5600 5601 listOpacityController(id) { 5602 id = parseInt(id); 5603 let aboveCurrent = this.listItems - id; 5604 let belowCurrent = parseInt(id); 5605 5606 if (aboveCurrent > 0) { 5607 for (let i = 1; i <= aboveCurrent; i++) { 5608 let opacity = 0.5 / i; 5609 let offset = 5 * i; 5610 TweenMax.to(this.getListItems()[id + i], 0.5, { 5611 autoAlpha: opacity, 5612 x: offset, 5613 ease: Power3.easeOut 5614 }); 5615 } 5616 } 5617 5618 if (belowCurrent > 0) { 5619 for (let i = 0; i <= belowCurrent; i++) { 5620 let opacity = 0.5 / i; 5621 let offset = 5 * i; 5622 TweenMax.to(this.getListItems()[id - i], 0.5, { 5623 autoAlpha: opacity, 5624 x: offset, 5625 ease: Power3.easeOut 5626 }); 5627 } 5628 } 5629 } 5630 } 5631 5632 new VerticalMouseDrivenCarousel(); 5633 5634 } ); 5635 //End execute javascript for mouse driven vertical carousel 5636 5637 //Start execute javascript for synchronized carousel slider 5638 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-synchronized-carousel.default', function( $scope ) { 5639 5640 jQuery(".synchronized-carousel-slider-wrapper").each(function() { 5641 var sliderID = jQuery(this).attr('id'); 5642 var slidersContainer = document.querySelector("#"+sliderID); 5643 var countSlide = jQuery(this).attr('data-countslide'); 5644 5645 // Initializing the numbers slider 5646 var msNumbers = new MomentumSlider({ 5647 el: slidersContainer, 5648 cssClass: "ms--numbers", 5649 range: [1, countSlide], 5650 rangeContent: function (i) { 5651 return "0" + i; 5652 }, 5653 style: { 5654 transform: [{scale: [0.4, 1]}], 5655 opacity: [0, 1] 5656 }, 5657 interactive: false 5658 }); 5659 5660 var titles = JSON.parse(jQuery(this).attr('data-slidetitles')); 5661 5662 var msTitles = new MomentumSlider({ 5663 el: slidersContainer, 5664 cssClass: "ms--titles", 5665 range: [0, parseInt(countSlide-1)], 5666 rangeContent: function (i) { 5667 return "<h3>"+ titles[i] +"</h3>"; 5668 }, 5669 vertical: true, 5670 reverse: true, 5671 style: { 5672 opacity: [0, 1] 5673 }, 5674 interactive: false 5675 }); 5676 5677 var buttonTitles = JSON.parse(jQuery(this).attr('data-slidebuttontitles')); 5678 var buttonUrls = JSON.parse(jQuery(this).attr('data-slidebuttonurls')); 5679 5680 // Initializing the links slider 5681 var msLinks = new MomentumSlider({ 5682 el: slidersContainer, 5683 cssClass: "ms--links", 5684 range: [0, parseInt(countSlide-1)], 5685 rangeContent: function (i) { 5686 return "<a href=\""+buttonUrls[i]+"\" class=\"ms-slide-link\">"+buttonTitles[i]+"</a>"; 5687 }, 5688 vertical: true, 5689 interactive: false 5690 }); 5691 5692 // Get pagination items 5693 var paginationID = jQuery(this).attr('data-pagination'); 5694 var pagination = document.querySelector("#"+paginationID); 5695 var paginationItems = [].slice.call(pagination.children); 5696
5697 var images = JSON.parse(jQuery(this).attr('data-slideimages')); 5698 5699 // Initializing the images slider 5700 var msImages = new MomentumSlider({ 5701 // Element to append the slider 5702 el: slidersContainer, 5703 // CSS class to reference the slider 5704 cssClass: "ms--images", 5705 // Generate the 4 slides required 5706 range: [0, parseInt(countSlide-1)], 5707 rangeContent: function (i) { 5708 return "<div class=\"ms-slide-image-container\"><div class=\"ms-slide-image\" style=\"background-image: url('"+images[i]+"')\"></div></div>"; 5709 }, 5710 // Syncronize the other sliders 5711 sync: [msNumbers, msTitles, msLinks], 5712 // Styles to interpolate as we move the slider 5713 style: { 5714 ".ms-slide-image": { 5715 transform: [{scale: [1.5, 1]}] 5716 } 5717 }, 5718 // Update pagination if slider change 5719 change: function(newIndex, oldIndex) { 5720 if (typeof oldIndex !== "undefined") { 5721 paginationItems[oldIndex].classList.remove("pagination-item--active"); 5722 } 5723 paginationItems[newIndex].classList.add("pagination-item--active"); 5724 } 5725 }); 5726 5727 pagination.addEventListener("click", function(e) { 5728 if (e.target.matches(".pagination-button")) { 5729 var index = paginationItems.indexOf(e.target.parentNode); 5730 msImages.select(index); 5731 } 5732 }); 5733 }); 5734 5735 } ); 5736 //End execute javascript for synchronized carousel slider 5737 5738 //Start execute javascript for flip box 5739 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-flip-box.default', function( $scope ) { 5740 5741 var countSquare = jQuery('.square').length; 5742 5743 //For each Square found add BG image 5744 for (i = 0; i < countSquare; i++) { 5745 var firstImage = jQuery('.square').eq([i]); 5746 var secondImage = jQuery('.square2').eq([i]); 5747 5748 var getImage = firstImage.attr('data-image'); 5749 var getImage2 = secondImage.attr('data-image'); 5750 5751 firstImage.css('background-image', 'url(' + getImage + ')'); 5752 secondImage.css('background-image', 'url(' + getImage2 + ')'); 5753 } 5754 5755 jQuery('.flip-box-wrapper').on('click', function() { 5756 jQuery(this).trigger("mouseover"); 5757 }); 5758 5759 } ); 5760 //End execute javascript for flip box 5761 5762 //Start execute javascript for slider zoom 5763 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-slider-zoom.default', function( $scope ) { 5764 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 5765 5766 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 5767 5768 var $window = $(window); 5769 var $body = $('body'); 5770 5771 var Slideshow = function () { 5772 function Slideshow() { 5773 var _this = this; 5774 5775 var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 5776 5777 _classCallCheck(this, Slideshow); 5778 5779 var timer = $('.slider-zoom-wrapper').attr('data-autoplay'); 5780 var autoplay = true; 5781 5782 if(timer == 0) 5783 { 5784 timer = false; 5785 autoplay = false; 5786 } 5787 5788 var pagination = $('.slider-zoom-wrapper').attr('data-pagination'); 5789 if(pagination == 0) 5790 { 5791 var pagination = false; 5792 } 5793 else 5794 { 5795 var pagination = true; 5796 } 5797 5798 var defaultOptions = { 5799 $el: $('.slider-zoom-wrapper'),
5800 showArrows: false, 5801 showPagination: false, 5802 duration: timer, 5803 autoplay: autoplay 5804 }; 5805 5806 var options = Object.assign({}, defaultOptions, userOptions); 5807 5808 this.$el = options.$el; 5809 this.maxSlide = this.$el.find($('.js-slider-home-slide')).length; 5810 this.showArrows = this.maxSlide > 1 ? options.showArrows : false; 5811 this.showPagination = pagination; 5812 this.currentSlide = 1; 5813 this.isAnimating = false; 5814 this.animationDuration = 1200; 5815 this.autoplaySpeed = options.duration; 5816 this.interval; 5817 this.$controls = this.$el.find('.js-slider-home-button'); 5818 this.autoplay = this.maxSlide > 1 ? options.autoplay : false; 5819 5820 this.$el.on('click', '.js-slider-home-next', function (event) { 5821 return _this.nextSlide(); 5822 }); 5823 this.$el.on('click', '.js-slider-home-prev', function (event) { 5824 return _this.prevSlide(); 5825 }); 5826 this.$el.on('click', '.js-pagination-item', function (event) { 5827 if (!_this.isAnimating) { 5828 _this.preventClick(); 5829 _this.goToSlide(event.target.dataset.slide); 5830 } 5831 }); 5832 5833 this.init(); 5834 } 5835 5836 _createClass(Slideshow, [{ 5837 key: 'init', 5838 value: function init() { 5839 this.goToSlide(1); 5840 5841 if (this.autoplay) { 5842 this.startAutoplay(); 5843 } 5844 5845 if (this.showPagination) { 5846 var paginationNumber = this.maxSlide; 5847 var pagination = '<div class="pagination"><div class="container">'; 5848 5849 for (var i = 0; i < this.maxSlide; i++) { 5850 var item = '<span class="pagination-item js-pagination-item ' + (i === 0 ? 'is-current' : '') + '" data-slide=' + (i + 1) + '>' + (i + 1) + '</span>'; 5851 pagination = pagination + item; 5852 } 5853 5854 pagination = pagination + '</div></div>'; 5855 5856 this.$el.append(pagination); 5857 } 5858 } 5859 }, { 5860 key: 'preventClick', 5861 value: function preventClick() { 5862 var _this2 = this; 5863 5864 this.isAnimating = true; 5865 this.$controls.prop('disabled', true); 5866 clearInterval(this.interval); 5867 5868 setTimeout(function () { 5869 _this2.isAnimating = false; 5870 _this2.$controls.prop('disabled', false); 5871 if (_this2.autoplay) { 5872 _this2.startAutoplay(); 5873 } 5874 }, this.animationDuration); 5875 } 5876 }, { 5877 key: 'goToSlide', 5878 value: function goToSlide(index) { 5879 this.currentSlide = parseInt(index); 5880 5881 if (this.currentSlide > this.maxSlide) { 5882 this.currentSlide = 1; 5883 } 5884 5885 if (this.currentSlide === 0) { 5886 this.currentSlide = this.maxSlide; 5887 } 5888 5889 var newCurrent = this.$el.find('.js-slider-home-slide[data-slide="' + this.currentSlide + '"]'); 5890 var newPrev = this.currentSlide === 1 ? this.$el.find('.js-slider-home-slide').last() : newCurrent.prev('.js-slider-home-slide'); 5891 var newNext = this.currentSlide === this.maxSlide ? this.$el.find('.js-slider-home-slide').first() : newCurrent.next('.js-slider-home-slide'); 5892 5893 this.$el.find('.js-slider-home-slide').removeClass('is-prev is-next is-current'); 5894 this.$el.find('.js-pagination-item').removeClass('is-current'); 5895 5896 if (this.maxSlide > 1) { 5897 newPrev.addClass('is-prev'); 5898 newNext.addClass('is-next'); 5899 } 5900 5901 newCurrent.addClass('is-current'); 5902 this.$el.find('.js-pagination-item[data-slide="' + this.currentSlide + '"]').addClass('is-current'); 5903 } 5904 }, { 5905 key: 'nextSlide', 5906 value: function nextSlide() { 5907 this.preventClick(); 5908 this.goToSlide(this.currentSlide + 1); 5909 } 5910 }, { 5911 key: 'prevSlide', 5912 value: function prevSlide() { 5913 this.preventClick(); 5914 this.goToSlide(this.currentSlide - 1); 5915 } 5916 }, { 5917 key: 'startAutoplay', 5918 value: function startAutoplay() { 5919 var _this3 = this; 5920 5921 this.interval = setInterval(function () { 5922 if (!_this3.isAnimating) { 5923 _this3.nextSlide(); 5924 } 5925 }, this.autoplaySpeed); 5926 } 5927 }, { 5928 key: 'destroy', 5929 value: function destroy() { 5930 this.$el.off(); 5931 } 5932 }]); 5933 5934 return Slideshow; 5935 }(); 5936 5937 (function () { 5938 var loaded = false;
5939 var maxLoad = 3000; 5940 5941 function load() { 5942 var options = { 5943 showPagination: true 5944 }; 5945 5946 var slideShow = new Slideshow(options); 5947 } 5948 5949 function addLoadClass() { 5950 $body.addClass('is-loaded'); 5951 5952 setTimeout(function () { 5953 $body.addClass('is-animated'); 5954 }, 600); 5955 } 5956 5957 $window.on('load', function () { 5958 if (!loaded) { 5959 loaded = true; 5960 load(); 5961 } 5962 }); 5963 5964 setTimeout(function () { 5965 if (!loaded) { 5966 loaded = true; 5967 load(); 5968 } 5969 }, maxLoad); 5970 5971 addLoadClass(); 5972 })(); 5973 } ); 5974 //End execute javascript for slider zoom 5975 5976 5977 //Start execute javascript for course grid 5978 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-course-grid.default', function( $scope ) { 5979 5980 jQuery('.course_tooltip').tooltipster({ 5981 position: 'right', 5982 multiple: true, 5983 contentCloning: true, 5984 theme: 'tooltipster-shadow', 5985 minWidth: 300, 5986 maxWidth: 300, 5987 delay: 50, 5988 interactive: true, 5989 }); 5990 5991 } ); 5992 //End execute javascript for course grid 5993 5994 5995 //Start execute javascript for search 5996 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-search.default', function( $scope ) { 5997 5998 jQuery(".avante-search-icon").each(function() { 5999 var iconInput = jQuery(this).find('a'); 6000 6001 iconInput.bind('click', function () { 6002 var openDiv = jQuery(this).attr('data-open'); 6003 jQuery('#'+openDiv).addClass('active'); 6004 6005 var isTouch = ('ontouchstart' in document.documentElement); 6006 if ( isTouch ) { 6007 jQuery('#'+openDiv).find('.avante-search-inner').addClass('touch'); 6008 } 6009 6010 jQuery('body').addClass('elementor-no-overflow'); 6011 6012 setTimeout(function(){ 6013 jQuery('#'+openDiv).find('.tg_search_form.autocomplete_form').find('input#s').trigger('focus'); 6014 }, 300); 6015 }); 6016 }); 6017 6018 jQuery(".tg_search_form.autocomplete_form").each(function() { 6019 var wrapper = jQuery(this).attr('data-open'); 6020 var formInput = jQuery(this).find('input[name="s"]'); 6021 var resultDiv = jQuery(this).attr('data-result'); 6022 var isTouch = ('ontouchstart' in document.documentElement); 6023 6024 if ( !isTouch ) { 6025 formInput.on('input', function() { 6026 if(jQuery(this).val().length > 1) 6027 { 6028 jQuery.ajax({ 6029 url: tgAjax.ajaxurl, 6030 type:'POST', 6031 data:'action=avante_ajax_search_result&'+jQuery(this).serialize(), 6032 success:function(results) { 6033 jQuery("#"+resultDiv).html(results); 6034 6035 if(results != '') 6036 { 6037 jQuery("#"+resultDiv).addClass('visible'); 6038 jQuery("#"+resultDiv).show(); 6039 jQuery("#"+resultDiv).css('z-index', 99); 6040 6041 jQuery("#"+resultDiv+ " ul li a").mousedown(function() { 6042 jQuery("#"+resultDiv).attr('data-mousedown', true); 6043 }); 6044 } 6045 else 6046 { 6047 jQuery("#"+resultDiv).hide(); 6048 } 6049 } 6050 }); 6051 } 6052 else 6053 { 6054 jQuery("#"+resultDiv).html(''); 6055 } 6056 }); 6057 } 6058 6059 formInput.bind('click', function () { 6060 jQuery("#"+resultDiv).addClass('visible'); 6061 jQuery("#"+resultDiv).attr('data-mousedown', 'true'); 6062 }); 6063 6064 formInput.bind('focus', function () { 6065 jQuery("#"+resultDiv).addClass('visible'); 6066 formInput.addClass('visible'); 6067 }); 6068 6069 formInput.bind('blur', function () { 6070 jQuery("#"+resultDiv).removeClass('visible'); 6071 formInput.removeClass('visible'); 6072 }); 6073 6074 jQuery("#"+wrapper).bind('click', function () { 6075 if(!formInput.hasClass('visible')) 6076 { 6077 if(jQuery("#"+resultDiv).attr('data-mousedown') != 'true') 6078 { 6079 jQuery("#"+resultDiv).removeClass('visible'); 6080 } 6081 jQuery('#'+wrapper).removeClass('active'); 6082 jQuery('body').removeClass('elementor-no-overflow'); 6083 } 6084 }); 6085 }); 6086 6087 } ); 6088 //End execute javascript for search 6089 6090 6091 //Start execute javascript for pricing table 6092 elementorFrontend.hooks.addAction( 'frontend/element_ready/avante-pricing-table.default', function( $scope ) { 6093 6094 var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch')); 6095
6096 elems.forEach(function(elem) { 6097 var switchery = new Switchery(elem, { disabled: true, disabledOpacity: 1, color: elem.getAttribute('data-switch-bg'), secondaryColor: elem.getAttribute('data-switch-bg'), jackColor: elem.getAttribute('data-switch-button'), jackSecondaryColor: elem.getAttribute('data-switch-button') }); 6098 }); 6099 6100 var changeCheckbox = document.querySelector('.js-switch'); 6101 6102 if (!!changeCheckbox) { 6103 changeCheckbox.onchange = function() { 6104 jQuery(".pricing-plan-price").each(function() { 6105 //If select yearly 6106 if(changeCheckbox.checked) 6107 { 6108 var pricingPlan = jQuery(this).attr('data-price-year'); 6109 jQuery(this).html(pricingPlan); 6110 jQuery('.pricing-plan-unit-month').addClass('hide'); 6111 jQuery('.pricing-plan-unit-year').removeClass('hide'); 6112 } 6113 //If select monthly 6114 else 6115 { 6116 var pricingPlan = jQuery(this).attr('data-price-month'); 6117 jQuery(this).html(pricingPlan); 6118 jQuery('.pricing-plan-unit-year').addClass('hide'); 6119 jQuery('.pricing-plan-unit-month').removeClass('hide'); 6120 } 6121 }); 6122 }; 6123 } 6124 } ); 6125 //End execute javascript for pricing table 6126 6127 } ); 6128 6129} )( 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.