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