1function isJson(str) { 2 try { 3 JSON.parse(str); 4 } catch (e) { 5 return false; 6 } 7 return true; 8} 9 10function isTouchDevice() { 11 return 'ontouchstart' in window // works on most browsers 12 || 'onmsgesturechange' in window; // works on ie10 13} 14 15function isMobileDevice() { 16 return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1); 17} 18 19jQuery.fn.isInViewport = function() { 20 var elementTop = jQuery(this).offset().top; 21 var elementBottom = elementTop + jQuery(this).outerHeight(); 22 23 var viewportTop = jQuery(window).scrollTop(); 24 var viewportBottom = viewportTop + jQuery(window).height(); 25 26 return elementBottom > viewportTop && elementTop < viewportBottom; 27}; 28 29( function( $ ) { 30 31 // Make sure you run this code under Elementor.. 32 $( window ).on( 'elementor/frontend/init', function() { 33 34 jQuery("img.lazy").each(function() { 35 var currentImg = jQuery(this); 36 37 jQuery(this).Lazy({ 38 onFinishedAll: function() { 39 currentImg.parent("div.post_img_hover").removeClass("lazy"); 40 currentImg.parent('.tg_gallery_lightbox').parent("div.gallery_grid_item").removeClass("lazy"); 41 } 42 }); 43 }); 44 45 elementorFrontend.hooks.addAction('frontend/element_ready/global', function( $scope ) { 46 47 if(elementorFrontend.isEditMode()) 48 { 49 var elementSettings = {}; 50 var modelCID = $scope.data( 'model-cid' ); 51 52 var settings = elementorFrontend.config.elements.data[ modelCID ]; 53 if(typeof settings != 'undefined') 54 { 55 var type = settings.attributes.widgetType || settings.attributes.elType, 56 settingsKeys = elementorFrontend.config.elements.keys[ type ]; 57 58 if ( ! settingsKeys ) { 59 settingsKeys = elementorFrontend.config.elements.keys[type] = []; 60 61 jQuery.each( settings.controls, function ( name, control ) { 62 if ( control.frontend_available ) { 63 settingsKeys.push( name ); 64 } 65 }); 66 } 67 68 jQuery.each( settings.getActiveControls(), function( controlKey ) { 69 if ( -1 !== settingsKeys.indexOf( controlKey ) ) { 70 elementSettings[ controlKey ] = settings.attributes[ controlKey ]; 71 } 72 } ); 73 74 var widgetExt = elementSettings; 75 } 76 } 77 else 78 { 79 //Get widget settings data 80 var widgetExtObj = $scope.attr('data-settings'); 81 82 if(isJson(widgetExtObj) && typeof widgetExtObj != 'undefined') 83 { 84 var widgetExt = JSON.parse(widgetExtObj); 85 } 86 } 87 88 if(typeof widgetExt != 'undefined') 89 { 90 //Begin background image parallax scrolling 91 if(typeof widgetExt.hoteller_ext_is_background_parallax != 'undefined' && widgetExt.hoteller_ext_is_background_parallax == 'true') 92 { 93 if(typeof widgetExt.background_background != 'undefined' && widgetExt.background_background == 'classic') 94 { 95 //If not edit in Elementor for better performance 96 if(!elementorFrontend.isEditMode()) 97 { 98 var widgetBg = $scope.css('background-image'); 99 100 //Add support for Elementor background lazy load 101 if(widgetBg == 'none') { 102 widgetBg = $scope.css('--e-bg-lazyload'); 103 } 104 105 widgetBg = widgetBg.replace('url(','').replace(')','').replace(/\"/gi, ""); 106 107 //parallaxator 108 /*$scope.addClass('parallaxator'); 109 $scope.append('<img class="parallax_child" src="'+widgetBg+'" data-parallaxator-reverse="true"/>');*/ 110 111 var jarallaxScrollSpeed = 0.5; 112 if(typeof widgetExt.hoteller_ext_is_background_parallax_speed.size != 'undefined') 113 { 114 jarallaxScrollSpeed = parseFloat(widgetExt.hoteller_ext_is_background_parallax_speed.size); 115 } 116 //console.log(jarallaxScrollSpeed); 117 //Jarallax 118 $scope.addClass('jarallax'); 119 $scope.append('<img class="jarallax-img" src="'+widgetBg+'"/>'); 120 121 $scope.jarallax({ 122 speed: jarallaxScrollSpeed 123 }); 124 125 if(!isMobileDevice()) 126 { 127 $scope.css('background-image', 'none'); 128 } 129 130 jQuery(window).resize(function() {
131 if(!isMobileDevice()) 132 { 133 $scope.css('background-image', 'none'); 134 } 135 else 136 { 137 $scope.css('background-image', 'url('+widgetBg+')'); 138 } 139 }); 140 } 141 } 142 } 143 144 //Begin backdrop filter 145 if(typeof widgetExt.hoteller_ext_is_background_backdrop != 'undefined' && widgetExt.hoteller_ext_is_background_backdrop == 'true') 146 { 147 $scope.css('backdrop-filter', 'blur('+parseInt(widgetExt.hoteller_ext_is_background_backdrop_blur.size)+'px)'); 148 } 149 150 if(typeof widgetExt.hoteller_ext_is_fadeout_animation != 'undefined' && widgetExt.hoteller_ext_is_fadeout_animation == 'true') 151 { 152 var scrollVelocity = parseFloat(widgetExt.hoteller_ext_is_fadeout_animation_velocity.size); 153 var scrollDirection = widgetExt.hoteller_ext_is_fadeout_animation_direction; 154 155 jQuery(window).scroll(function(i){ 156 var scrollVar = jQuery(window).scrollTop(); 157 var scrollPx = -(scrollVelocity*scrollVar); 158 159 if(scrollDirection == 'up') 160 { 161 scrollPx = -(scrollVelocity*scrollVar); 162 } 163 else if(scrollDirection == 'down') 164 { 165 scrollPx = scrollVelocity*scrollVar; 166 } 167 else 168 { 169 scrollPx = 0; 170 } 171 172 //console.log(scrollVelocity); 173 $scope.find('.elementor-widget-container').css({'transform': "translateY("+scrollPx+"px)" }); 174 $scope.find('.elementor-widget-container').css({'opacity':( 100-(scrollVar/4) )/100}); 175 }) 176 } 177 178 179 //Begin scroll animation extensions 180 if(typeof widgetExt.hoteller_ext_is_scrollme != 'undefined' && widgetExt.hoteller_ext_is_scrollme == 'true') 181 { 182 var scrollArgs = {}; 183 184 if(typeof widgetExt.hoteller_ext_scrollme_scalex.size != 'undefined' && widgetExt.hoteller_ext_scrollme_scalex.size != 1) 185 { 186 scrollArgs['scaleX'] = widgetExt.hoteller_ext_scrollme_scalex.size; 187 } 188 189 if(typeof widgetExt.hoteller_ext_scrollme_scaley.size != 'undefined' && widgetExt.hoteller_ext_scrollme_scaley.size != 1) 190 { 191 scrollArgs['scaleY'] = widgetExt.hoteller_ext_scrollme_scaley.size; 192 } 193 194 if(typeof widgetExt.hoteller_ext_scrollme_scalez.size != 'undefined' && widgetExt.hoteller_ext_scrollme_scalez.size != 1) 195 { 196 scrollArgs['scaleZ'] = widgetExt.hoteller_ext_scrollme_scalez.size; 197 } 198 199 if(typeof widgetExt.hoteller_ext_scrollme_rotatex.size != 'undefined' && widgetExt.hoteller_ext_scrollme_rotatex.size != 0) 200 { 201 scrollArgs['rotateX'] = widgetExt.hoteller_ext_scrollme_rotatex.size; 202 } 203 204 if(typeof widgetExt.hoteller_ext_scrollme_rotatey.size != 'undefined' && widgetExt.hoteller_ext_scrollme_rotatey.size != 0) 205 { 206 scrollArgs['rotateY'] = widgetExt.hoteller_ext_scrollme_rotatey.size; 207 } 208 209 if(typeof widgetExt.hoteller_ext_scrollme_rotatez.size != 'undefined' && widgetExt.hoteller_ext_scrollme_rotatez.size != 0) 210 { 211 scrollArgs['rotateY'] = widgetExt.hoteller_ext_scrollme_rotatez.size; 212 } 213 214 if(typeof widgetExt.hoteller_ext_scrollme_translatex.size != 'undefined' && widgetExt.hoteller_ext_scrollme_translatex.size != 0) 215 { 216 scrollArgs['x'] = widgetExt.hoteller_ext_scrollme_translatex.size; 217 } 218 219 if(typeof widgetExt.hoteller_ext_scrollme_translatey.size != 'undefined' && widgetExt.hoteller_ext_scrollme_translatey.size != 0) 220 { 221 scrollArgs['y'] = widgetExt.hoteller_ext_scrollme_translatey.size; 222 } 223 224 if(typeof widgetExt.hoteller_ext_scrollme_translatez.size != 'undefined' && widgetExt.hoteller_ext_scrollme_translatez.size != 0) 225 { 226 scrollArgs['z'] = widgetExt.hoteller_ext_scrollme_translatez.size; 227 } 228 229 if(typeof widgetExt.hoteller_ext_scrollme_smoothness.size != 'undefined') 230 { 231 scrollArgs['smoothness'] = widgetExt.hoteller_ext_scrollme_smoothness.size; 232 } 233 234 //scrollArgs['duration'] = 150; 235 236 $scope.attr('data-parallax', JSON.stringify(scrollArgs)); 237 238 if(typeof widgetExt.hoteller_ext_scrollme_disable != 'undefined') 239 { 240 if(widgetExt.hoteller_ext_scrollme_disable == 'mobile') 241 {
242 if(parseInt(jQuery(window).width()) < 501) 243 { 244 $scope.addClass('noanimation'); 245 } 246 } 247 248 if(widgetExt.hoteller_ext_scrollme_disable == 'tablet') 249 { 250 if(parseInt(jQuery(window).width()) < 769) 251 { 252 $scope.addClass('noanimation'); 253 } 254 } 255 256 jQuery(window).resize(function() { 257 if(widgetExt.hoteller_ext_scrollme_disable == 'mobile') 258 { 259 if(isMobileDevice() || parseInt(jQuery(window).width()) < 501) 260 { 261 $scope.addClass('noanimation'); 262 } 263 else 264 { 265 $scope.removeClass('noanimation'); 266 } 267 } 268 269 if(widgetExt.hoteller_ext_scrollme_disable == 'tablet') 270 { 271 if(parseInt(jQuery(window).width()) < 769) 272 { 273 $scope.addClass('noanimation'); 274 } 275 else 276 { 277 $scope.removeClass('noanimation'); 278 } 279 } 280 }); 281 } 282 } 283 //End scroll animation extensions 284 285 //Begin entrance animation extensions 286 if(typeof widgetExt.hoteller_ext_is_smoove != 'undefined' && widgetExt.hoteller_ext_is_smoove == 'true') 287 { 288 $scope.addClass('init-smoove'); 289 290 $scope.smoove({ 291 min_width : parseInt(widgetExt.hoteller_ext_smoove_disable), 292 293 scaleX : widgetExt.hoteller_ext_smoove_scalex.size, 294 scaleY : widgetExt.hoteller_ext_smoove_scaley.size, 295 296 rotateX : parseInt(widgetExt.hoteller_ext_smoove_rotatex.size)+'deg', 297 rotateY : parseInt(widgetExt.hoteller_ext_smoove_rotatey.size)+'deg', 298 rotateZ : parseInt(widgetExt.hoteller_ext_smoove_rotatez.size)+'deg', 299 300 moveX : parseInt(widgetExt.hoteller_ext_smoove_translatex.size)+'px', 301 moveY : parseInt(widgetExt.hoteller_ext_smoove_translatey.size)+'px', 302 moveZ : parseInt(widgetExt.hoteller_ext_smoove_translatez.size)+'px', 303 304 skewX : parseInt(widgetExt.hoteller_ext_smoove_skewx.size)+'deg', 305 skewY : parseInt(widgetExt.hoteller_ext_smoove_skewy.size)+'deg', 306 307 perspective : parseInt(widgetExt.hoteller_ext_smoove_perspective.size), 308 309 offset : '-10%', 310 }); 311 312 if(typeof widgetExt.hoteller_ext_smoove_duration != 'undefined') 313 { 314 $scope.css('transition-duration', parseInt(widgetExt.hoteller_ext_smoove_duration)+'ms'); 315 } 316 317 var width = jQuery(window).width(); 318 if (widgetExt.hoteller_ext_smoove_disable >= width) { 319 if(!$scope.hasClass('smooved')) 320 { 321 $scope.addClass('no-smooved'); 322 } 323 324 return false; 325 } 326 327 setTimeout(function(){ 328 window.scrollTo(window.scrollX, window.scrollY - 1); 329 window.scrollTo(window.scrollX, window.scrollY + 1); 330 }, 1000); 331 } 332 //End entrance animation extensions 333 334 335 //Begin mouse parallax extensions 336 if(typeof widgetExt.hoteller_ext_is_parallax_mouse != 'undefined' && widgetExt.hoteller_ext_is_parallax_mouse == 'true') 337 { 338 var elementID = $scope.attr('data-id'); 339 $scope.find('.elementor-widget-container').attr('data-depth', parseFloat(widgetExt.hoteller_ext_is_parallax_mouse_depth.size)); 340 $scope.attr('ID', 'parallax-'+elementID); 341 342 var parentElement = document.getElementById('parallax-'+elementID); 343 var parallax = new Parallax(parentElement, { 344 relativeInput: true 345 }); 346 347 if(elementorFrontend.isEditMode()) 348 { 349 if($scope.width() == 0) 350 { 351 $scope.css('width', '100%'); 352 } 353 354 if($scope.height() == 0) 355 { 356 $scope.css('height', '100%'); 357 } 358 } 359 } 360 //End mouse parallax extensions 361 362 363 //Begin infinite animation extensions 364 if(typeof widgetExt.hoteller_ext_is_infinite != 'undefined' && widgetExt.hoteller_ext_is_infinite == 'true') 365 { 366 var animationClass = ''; 367 var keyframeName = ''; 368 var animationCSS = ''; 369 370 if(typeof widgetExt.hoteller_ext_infinite_animation != 'undefined') 371 { 372 animationClass = widgetExt.hoteller_ext_infinite_animation; 373 374 switch(animationClass) { 375 case 'if_swing1': 376 keyframeName = 'swing'; 377 break; 378 379 case 'if_swing2': 380 keyframeName = 'swing2'; 381 break; 382 383 case 'if_wave': 384 keyframeName = 'wave'; 385 break; 386 387 case 'if_tilt': 388 keyframeName = 'tilt'; 389 break; 390 391 case 'if_bounce': 392 keyframeName = 'bounce'; 393 break; 394 395 case 'if_scale': 396 keyframeName = 'scale'; 397 break; 398 399 case 'if_spin': 400 keyframeName = 'spin'; 401 break; 402 } 403 404 animationCSS+= keyframeName+' '; 405 } 406 407 if(typeof widgetExt.hoteller_ext_infinite_duration != 'undefined') 408 { 409 animationCSS+= widgetExt.hoteller_ext_infinite_duration+'s '; 410 } 411 412 animationCSS+= 'infinite alternate '; 413 414 if(typeof widgetExt.hoteller_ext_infinite_easing != 'undefined') 415 { 416 animationCSS+= 'cubic-bezier('+widgetExt.hoteller_ext_infinite_easing+')'; 417 } 418 419 $scope.css({ 420 'animation' : animationCSS, 421 }); 422 $scope.addClass(animationClass); 423 } 424 //End infinite animation extensions 425 426 //Begin link to side menu extensions 427 if(typeof widgetExt.hoteller_ext_link_sidemenu != 'undefined' && widgetExt.hoteller_ext_link_sidemenu == 'true') 428 { 429 $scope.on( 'click', function(e) { 430 e.preventDefault(); 431 432 jQuery('body,html').animate({scrollTop:0},100); 433 jQuery('body').addClass('js_nav'); 434 jQuery('body').addClass('modalview'); 435 jQuery('#close_mobile_menu').addClass('open'); 436 }); 437 } 438 439 //Begin link to fullscreen menu extensions 440 if(typeof widgetExt.hoteller_ext_link_fullmenu != 'undefined' && widgetExt.hoteller_ext_link_fullmenu == 'true') 441 { 442 $scope.addClass('fullmenu-button'); 443 444 $scope.on( 'click', function(e) { 445 e.preventDefault(); 446 447 //jQuery('body,html').animate({scrollTop:0},100); 448 jQuery('body').toggleClass('fullmenu-active').trigger('classChange'); 449 jQuery('.fullmenu-wrapper').toggleClass('fullmenu-wrapper-active'); 450 }); 451 } 452 453 if(typeof widgetExt.hoteller_ext_link_closed_fullmenu != 'undefined' && widgetExt.hoteller_ext_link_closed_fullmenu == 'true') 454 { 455 $scope.on( 'click', function(e) { 456 e.preventDefault(); 457 458 jQuery('body').removeClass('fullmenu-active').trigger('classChange'); 459 jQuery('.fullmenu-wrapper').removeClass('fullmenu-wrapper-active'); 460 }); 461 } 462 463 //Begin background on change extensions 464 if(typeof widgetExt.hoteller_ext_is_background_on_scroll != 'undefined' && widgetExt.hoteller_ext_is_background_on_scroll == 'true') 465 {
466 var bodyBackground = jQuery('body').css('background-color'); 467 var position = jQuery(window).scrollTop(); 468 469 jQuery(window).on("scroll touchmove", function() { 470 clearTimeout($.data(this, 'scrollTimer')); 471 $.data(this, 'scrollTimer', setTimeout(function() { 472 jQuery('body').attr('data-scrollend', jQuery(window).scrollTop()); 473 }, 250)); 474 475 var scroll = jQuery(window).scrollTop(); 476 var position = jQuery('body').attr('data-scrollend'); 477 var windowHeight = jQuery(window).height(); 478 var windowHeightOffset = parseInt(windowHeight/2); 479 var elementTop = $scope.position().top - windowHeightOffset; 480 var elementBottom = elementTop + $scope.outerHeight(true); 481 482 /*console.log('document scroll top: '+jQuery(document).scrollTop()); 483 console.log('element top: '+elementTop); 484 console.log('element bottom: '+elementBottom);*/ 485 486 if (scroll > position) { 487 //console.log('scroll down'); 488 489 //Scroll down 490 if (jQuery(document).scrollTop() >= elementTop && jQuery(document).scrollTop() <= elementBottom) { 491 //jQuery('body').css('background-color', widgetExt.hoteller_ext_background_on_scroll_color); 492 jQuery('#wrapper').css('background-color', widgetExt.hoteller_ext_background_on_scroll_color); 493 } 494 495 if (jQuery(document).scrollTop() > elementBottom) { 496 //jQuery('body').css('background-color', bodyBackground); 497 jQuery('#wrapper').css('background-color', bodyBackground); 498 } 499 500 } else { 501 /*console.log('scroll up'); 502 console.log('document scroll top: '+jQuery(document).scrollTop()); 503 console.log('element top: '+$scope.position().top); 504 console.log('element bottom: '+elementBottom);*/ 505 506 //Scroll up 507 if (jQuery(document).scrollTop() <= elementBottom && jQuery(document).scrollTop() >= elementTop) { 508 setTimeout(function(){ 509 //jQuery('body').css('background-color', widgetExt.hoteller_ext_background_on_scroll_color).stop(); 510 jQuery('#wrapper').css('background-color', widgetExt.hoteller_ext_background_on_scroll_color).stop(); 511 }, 100); 512 } 513 514 if (jQuery(document).scrollTop() < $scope.position().top) { 515 //jQuery('body').css('background-color', bodyBackground); 516 jQuery('#wrapper').css('background-color', bodyBackground); 517 } 518 } 519 }); 520 } 521 //End background on change extensions 522 523 //Begin mobile static position extensions 524 if(typeof widgetExt.hoteller_ext_mobile_static != 'undefined' && widgetExt.hoteller_ext_mobile_static == 'true') 525 { 526 $scope.addClass('mobile-static'); 527 } 528 //End mobile static position extensions 529 530 //Begin sticky position extensions 531 /*if(typeof widgetExt.hoteller_ext_position_sticky != 'undefined' && widgetExt.hoteller_ext_position_sticky == 'true') 532 { 533 $scope.find(".elementor-widget-container").stick_in_parent({ parent: "#wrapper", recalc_every: 1 }); 534 }*/ 535 //End sticky position extensions 536 } 537 }); 538 539 //Start execute javascript for blog posts 540 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-blog-posts.default', function( $scope ) { 541 jQuery(function( $ ) { 542 jQuery("img.lazy").each(function() { 543 var currentImg = jQuery(this); 544 545 jQuery(this).Lazy({ 546 onFinishedAll: function() { 547 currentImg.parent("div.post_img_hover").removeClass("lazy"); 548 }, 549 }); 550 }); 551 552 if(!is_touch_device()) 553 { 554 var scaleTilt = 1.05; 555 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 556 scaleTilt = 1; 557 } 558 559 jQuery(".blog-tilt").tilt({ 560 scale: scaleTilt, 561 perspective: 2500 562 }); 563 } 564 565 jQuery(".layout_masonry").each(function() { 566 var grid = jQuery(this); 567 568 grid.imagesLoaded().progress( function() { 569 grid.masonry({ 570 itemSelector: ".blog-posts-masonry", 571 columnWidth: ".blog-posts-masonry", 572 gutter : 45 573 }); 574 575 jQuery(".layout_masonry .blog-posts-masonry").each(function(index) { 576 setTimeout(function() { 577 jQuery(".layout_masonry .blog-posts-masonry").eq(index).addClass("is-showing"); 578 }, 250 * index); 579 }); 580 }); 581 582 jQuery(".layout_masonry img.lazy_masonry").each(function() { 583 var currentImg = jQuery(this); 584 currentImg.parent("div.post_img_hover").removeClass("lazy"); 585 586 jQuery(this).Lazy({ 587 onFinishedAll: function() { 588 grid.masonry({ 589 itemSelector: ".blog-posts-masonry", 590 columnWidth: ".blog-posts-masonry", 591 gutter : 45 592 }); 593 }, 594 }); 595 }); 596 }); 597 598 jQuery(".layout_metro_masonry").each(function() { 599 var grid = jQuery(this); 600 601 grid.imagesLoaded().progress( function() { 602 grid.masonry({ 603 itemSelector: ".blog-posts-metro", 604 columnWidth: ".blog-posts-metro", 605 gutter : 40 606 }); 607 608 jQuery(".layout_metro_masonry .blog-posts-metro").each(function(index) { 609 setTimeout(function() { 610 jQuery(".layout_metro_masonry .blog-posts-metro").eq(index).addClass("is-showing"); 611 }, 100 * index); 612 }); 613 }); 614 615 jQuery(".post_metro_left_wrapper img.lazy_masonry, .layout_metro_masonry img.lazy_masonry").each(function() { 616 var currentImg = jQuery(this); 617 currentImg.parent("div.post_img_hover").removeClass("lazy"); 618 619 jQuery(this).Lazy({ 620 onFinishedAll: function() { 621 grid.masonry({ 622 itemSelector: ".blog-posts-metro", 623 columnWidth: ".blog-posts-metro", 624 gutter : 40 625 }); 626 }, 627 }); 628 }); 629 }); 630 631 var menuLayout = jQuery('#pp_menu_layout').val();
632 if(menuLayout != 'leftmenu') 633 { 634 jQuery(".post_metro_left_wrapper").stick_in_parent({ offset_top: 120 }); 635 } 636 else 637 { 638 jQuery(".post_metro_left_wrapper").stick_in_parent({ offset_top: 40 }); 639 } 640 641 if(jQuery(window).width() < 768 || is_touch_device()) 642 { 643 jQuery(".post_metro_left_wrapper").trigger("sticky_kit:detach"); 644 } 645 }); 646 } ); 647 //End execute javascript for blog posts 648 649 //Start execute javascript for gallery grid 650 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-gallery-grid.default', function( $scope ) { 651 jQuery("img.lazy").each(function() { 652 var currentImg = jQuery(this); 653 654 jQuery(this).Lazy({ 655 onFinishedAll: function() { 656 currentImg.parent("div.post_img_hover").removeClass("lazy"); 657 currentImg.parent('.tg_gallery_lightbox').parent("div.gallery_grid_item").removeClass("lazy"); 658 currentImg.parent("div.gallery_grid_item").removeClass("lazy"); 659 } 660 }); 661 }); 662 663 jQuery(function( $ ) { 664 if(!is_touch_device()) 665 { 666 var scaleTilt = 1.1; 667 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 668 scaleTilt = 1; 669 } 670 jQuery(".gallery-grid-tilt").tilt({ 671 scale: scaleTilt, 672 perspective: 2500 673 }); 674 } 675 }); 676 } ); 677 //End execute javascript for gallery grid 678 679 //Start execute javascript for gallery masonry 680 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-gallery-masonry.default', function( $scope ) { 681 jQuery(function( $ ) { 682 if(!is_touch_device()) 683 { 684 var scaleTilt = 1.1; 685 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 686 scaleTilt = 1; 687 } 688 jQuery(".gallery-grid-tilt").tilt({ 689 scale: scaleTilt, 690 perspective: 2500 691 }); 692 } 693 694 jQuery(".gallery_grid_content_wrapper.do_masonry").each(function() { 695 var grid = jQuery(this); 696 var cols = grid.attr('data-cols'); 697 698 if(!grid.hasClass('has_no_space')) 699 { 700 var gutter = 40; 701 if(cols > 4) 702 { 703 gutter = 30; 704 } 705 } 706 else 707 { 708 gutter = 0; 709 } 710 711 grid.imagesLoaded().progress( function() { 712 grid.masonry({ 713 itemSelector: ".gallery_grid_item", 714 columnWidth: ".gallery_grid_item", 715 gutter : gutter 716 }); 717 718 jQuery(".gallery_grid_content_wrapper.do_masonry .gallery_grid_item").each(function(index) { 719 setTimeout(function() { 720 jQuery(".do_masonry .gallery_grid_item").eq(index).addClass("is-showing"); 721 }, 100 * index); 722 }); 723 }); 724 725 jQuery(".gallery_grid_content_wrapper.do_masonry img.lazy_masonry").each(function() { 726 var currentImg = jQuery(this); 727 currentImg.parent("div.post_img_hover").removeClass("lazy"); 728 729 var cols = grid.attr('data-cols'); 730 731 if(!grid.hasClass('has_no_space')) 732 { 733 var gutter = 40; 734 if(cols > 4) 735 { 736 gutter = 30; 737 } 738 } 739 else 740 { 741 gutter = 0; 742 } 743 744 jQuery(this).Lazy({ 745 onFinishedAll: function() { 746 grid.masonry({ 747 itemSelector: ".gallery_grid_item", 748 columnWidth: ".gallery_grid_item", 749 gutter : gutter 750 }); 751 }, 752 }); 753 }); 754 }); 755 }); 756 } ); 757 //End execute javascript for gallery masonry 758 759 //Start execute javascript for gallery justified 760 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-gallery-justified.default', function( $scope ) { 761 jQuery(function( $ ) { 762 if(!is_touch_device()) 763 { 764 var scaleTilt = 1.1; 765 if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) { 766 scaleTilt = 1; 767 } 768 jQuery(".gallery-grid-tilt").tilt({ 769 scale: scaleTilt, 770 perspective: 2500 771 }); 772 } 773 774 jQuery("img.lazy").each(function() { 775 var currentImg = jQuery(this); 776 777 jQuery(this).Lazy({ 778 onFinishedAll: function() { 779 currentImg.parent("div.post_img_hover").removeClass("lazy"); 780 } 781 }); 782 }); 783 784 jQuery(".gallery_grid_content_wrapper.do_justified").each(function() { 785 var grid = jQuery(this); 786 var rowHeight = grid.attr('data-row_height'); 787 var margin = grid.attr('data-margin'); 788 var justifyLastRow = grid.attr('data-justify_last_row'); 789 var justifyLastRowStr = 'nojustify'; 790 if(justifyLastRow == 'yes') 791 { 792 justifyLastRowStr = 'justify'; 793 } 794
795 grid.imagesLoaded().always( function() { 796 grid.justifiedGallery({ 797 rowHeight: rowHeight, 798 margins: margin, 799 lastRow: justifyLastRowStr 800 }); 801 }); 802 }); 803 }); 804 } ); 805 //End execute javascript for gallery justified 806 807 //Start execute javascript for gallery horizontal 808 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-gallery-horizontal.default', function( $scope ) { 809 jQuery(".tg_horizontal_gallery_wrapper").each(function() { 810 var $carousel = jQuery(this); 811 var timer = $carousel.attr('data-autoplay'); 812 if(timer == 0) 813 { 814 timer = false; 815 } 816 817 var loop = $carousel.attr('data-loop'); 818 var navigation = $carousel.attr('data-navigation'); 819 if(navigation == 0) 820 { 821 navigation = false; 822 } 823 824 var pagination = $carousel.attr('data-pagination'); 825 if(pagination == 0) 826 { 827 pagination = false; 828 } 829 830 $carousel.flickity({ 831 percentPosition: false, 832 imagesLoaded: true, 833 selectedAttraction: 0.01, 834 friction: 0.2, 835 lazyLoad: 5, 836 pauseAutoPlayOnHover: true, 837 autoPlay: parseInt(timer), 838 contain: true, 839 prevNextButtons: navigation, 840 pageDots: pagination 841 }); 842 843 var parallax = $carousel.attr('data-parallax'); 844 if(parallax == 1) 845 { 846 var $imgs = $carousel.find('.tg_horizontal_gallery_cell img'); 847 848 var docStyle = document.documentElement.style; 849 var transformProp = typeof docStyle.transform == 'string' ? 850 'transform' : 'WebkitTransform'; 851 852 var flkty = $carousel.data('flickity'); 853 854 $carousel.on( 'scroll.flickity', function() { 855 flkty.slides.forEach( function( slide, i ) { 856 var img = $imgs[i]; 857 var x = ( slide.target + flkty.x ) * -1/3; 858 img.style[ transformProp ] = 'translateX(' + x + 'px)'; 859 }); 860 }); 861 } 862 863 var fullscreen = $carousel.attr('data-fullscreen'); 864 if(typeof fullscreen != 'undefined' && fullscreen != 0) 865 { 866 jQuery('body').addClass('elementor-fullscreen'); 867 868 //Get menu element height 869 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 870 var documentHeight = jQuery(window).innerHeight(); 871 var sliderHeight = parseInt(documentHeight - menuHeight); 872 873 $carousel.find('.tg_horizontal_gallery_cell').css('height', sliderHeight+'px'); 874 $carousel.find('.tg_horizontal_gallery_cell_img').css('height', sliderHeight+'px'); 875 $carousel.flickity('resize'); 876 877 jQuery( window ).resize(function() { 878 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 879 var documentHeight = jQuery(window).innerHeight(); 880 var sliderHeight = parseInt(documentHeight - menuHeight); 881 882 $carousel.find('.tg_horizontal_gallery_cell').css('height', sliderHeight+'px'); 883 $carousel.find('.tg_horizontal_gallery_cell_img').css('height', sliderHeight+'px'); 884 $carousel.flickity('resize'); 885 }); 886 } 887 }); 888 } ); 889 //End execute javascript for gallery horizontal 890 891 //Start execute javascript for slider horizontal 892 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-slider-horizontal.default', function( $scope ) { 893 jQuery(".tg_horizontal_slider_wrapper").each(function() { 894 var $carousel = jQuery(this); 895 var timer = $carousel.attr('data-autoplay'); 896 if(timer == 0) 897 { 898 timer = false; 899 } 900 901 var loop = $carousel.attr('data-loop'); 902 var navigation = $carousel.attr('data-navigation'); 903 if(navigation == 0) 904 { 905 navigation = false; 906 } 907 908 var pagination = $carousel.attr('data-pagination'); 909 if(pagination == 0) 910 { 911 pagination = false; 912 } 913 914 $carousel.flickity({ 915 percentPosition: false, 916 imagesLoaded: true, 917 pauseAutoPlayOnHover: true, 918 autoPlay: parseInt(timer), 919 contain: true, 920 prevNextButtons: navigation, 921 pageDots: pagination 922 }); 923 924 var fullscreen = $carousel.attr('data-fullscreen'); 925 if(fullscreen != 0) 926 { 927 jQuery('body').addClass('elementor-fullscreen'); 928 929 //Get menu element height
930 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 931 var documentHeight = jQuery(window).innerHeight(); 932 var sliderHeight = parseInt(documentHeight - menuHeight); 933 934 $carousel.find('.tg_horizontal_slider_cell').css('height', sliderHeight+'px'); 935 $carousel.flickity('resize'); 936 937 jQuery( window ).resize(function() { 938 var menuHeight = parseInt(jQuery('#wrapper').css('paddingTop')); 939 var documentHeight = jQuery(window).innerHeight(); 940 var sliderHeight = parseInt(documentHeight - menuHeight); 941 942 $carousel.find('.tg_horizontal_slider_cell').css('height', sliderHeight+'px'); 943 $carousel.flickity('resize'); 944 }); 945 } 946 }); 947 } ); 948 //End execute javascript for slider horizontal 949 950 //Start execute javascript for album grid 951 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-album-grid.default', function( $scope ) { 952 jQuery(function( $ ) { 953 var tiltSettings = [ 954 {}, 955 { 956 movement: { 957 imgWrapper : { 958 translation : {x: 10, y: 10, z: 30}, 959 rotation : {x: 0, y: -10, z: 0}, 960 reverseAnimation : {duration : 200, easing : 'easeOutQuad'} 961 }, 962 lines : { 963 translation : {x: 10, y: 10, z: [0,70]}, 964 rotation : {x: 0, y: 0, z: -2}, 965 reverseAnimation : {duration : 2000, easing : 'easeOutExpo'} 966 }, 967 caption : { 968 rotation : {x: 0, y: 0, z: 2}, 969 reverseAnimation : {duration : 200, easing : 'easeOutQuad'} 970 }, 971 overlay : { 972 translation : {x: 10, y: -10, z: 0}, 973 rotation : {x: 0, y: 0, z: 2}, 974 reverseAnimation : {duration : 2000, easing : 'easeOutExpo'} 975 }, 976 shine : { 977 translation : {x: 100, y: 100, z: 0}, 978 reverseAnimation : {duration : 200, easing : 'easeOutQuad'} 979 } 980 } 981 }, 982 { 983 movement: { 984 imgWrapper : { 985 rotation : {x: -5, y: 10, z: 0}, 986 reverseAnimation : {duration : 900, easing : 'easeOutCubic'} 987 }, 988 caption : { 989 translation : {x: 30, y: 30, z: [0,40]}, 990 rotation : {x: [0,15], y: 0, z: 0}, 991 reverseAnimation : {duration : 1200, easing : 'easeOutExpo'} 992 }, 993 overlay : { 994 translation : {x: 10, y: 10, z: [0,20]}, 995 reverseAnimation : {duration : 1000, easing : 'easeOutExpo'} 996 }, 997 shine : { 998 translation : {x: 100, y: 100, z: 0}, 999 reverseAnimation : {duration : 900, easing : 'easeOutCubic'} 1000 } 1001 } 1002 }, 1003 { 1004 movement: { 1005 imgWrapper : { 1006 rotation : {x: -5, y: 10, z: 0}, 1007 reverseAnimation : {duration : 50, easing : 'easeOutQuad'} 1008 }, 1009 caption : { 1010 translation : {x: 20, y: 20, z: 0}, 1011 reverseAnimation : {duration : 200, easing : 'easeOutQuad'} 1012 }, 1013 overlay : { 1014 translation : {x: 5, y: -5, z: 0}, 1015 rotation : {x: 0, y: 0, z: 6}, 1016 reverseAnimation : {duration : 1000, easing : 'easeOutQuad'} 1017 }, 1018 shine : { 1019 translation : {x: 50, y: 50, z: 0}, 1020 reverseAnimation : {duration : 50, easing : 'easeOutQuad'} 1021 } 1022 } 1023 }, 1024 { 1025 movement: { 1026 imgWrapper : { 1027 translation : {x: 0, y: -8, z: 0}, 1028 rotation : {x: 3, y: 3, z: 0}, 1029 reverseAnimation : {duration : 1200, easing : 'easeOutExpo'} 1030 }, 1031 lines : { 1032 translation : {x: 15, y: 15, z: [0,15]}, 1033 reverseAnimation : {duration : 1200, easing : 'easeOutExpo'} 1034 }, 1035 overlay : { 1036 translation : {x: 0, y: 8, z: 0}, 1037 reverseAnimation : {duration : 600, easing : 'easeOutExpo'} 1038 }, 1039 caption : { 1040 translation : {x: 10, y: -15, z: 0}, 1041 reverseAnimation : {duration : 900, easing : 'easeOutExpo'} 1042 }, 1043 shine : { 1044 translation : {x: 50, y: 50, z: 0}, 1045 reverseAnimation : {duration : 1200, easing : 'easeOutExpo'} 1046 } 1047 } 1048 }, 1049 { 1050 movement: { 1051 lines : { 1052 translation : {x: -5, y: 5, z: 0}, 1053 reverseAnimation : {duration : 1000, easing : 'easeOutExpo'} 1054 }, 1055 caption : { 1056 translation : {x: 15, y: 15, z: 0}, 1057 rotation : {x: 0, y: 0, z: 3}, 1058 reverseAnimation : {duration : 1500, easing : 'easeOutElastic', elasticity : 700} 1059 }, 1060 overlay : { 1061 translation : {x: 15, y: -15, z: 0}, 1062 reverseAnimation : {duration : 500,easing : 'easeOutExpo'} 1063 }, 1064 shine : { 1065 translation : {x: 50, y: 50, z: 0}, 1066 reverseAnimation : {duration : 500, easing : 'easeOutExpo'} 1067 } 1068 } 1069 }, 1070 { 1071 movement: { 1072 imgWrapper : { 1073 translation : {x: 5, y: 5, z: 0}, 1074 reverseAnimation : {duration : 800, easing : 'easeOutQuart'} 1075 }, 1076 caption : { 1077 translation : {x: 10, y: 10, z: [0,50]}, 1078 reverseAnimation : {duration : 1000, easing : 'easeOutQuart'} 1079 }, 1080 shine : { 1081 translation : {x: 50, y: 50, z: 0}, 1082 reverseAnimation : {duration : 800, easing : 'easeOutQuart'} 1083 } 1084 } 1085 }, 1086 { 1087 movement: { 1088 lines : { 1089 translation : {x: 40, y: 40, z: 0}, 1090 reverseAnimation : {duration : 1500, easing : 'easeOutElastic'} 1091 }, 1092 caption : { 1093 translation : {x: 20, y: 20, z: 0}, 1094 rotation : {x: 0, y: 0, z: -5}, 1095 reverseAnimation : {duration : 1000, easing : 'easeOutExpo'} 1096 }, 1097 overlay : { 1098 translation : {x: -30, y: -30, z: 0}, 1099 rotation : {x: 0, y: 0, z: 3}, 1100 reverseAnimation : {duration : 750, easing : 'easeOutExpo'} 1101 }, 1102 shine : { 1103 translation : {x: 100, y: 100, z: 0}, 1104 reverseAnimation : {duration : 750, easing : 'easeOutExpo'} 1105 } 1106 } 1107 }]; 1108
1109 function init() { 1110 var idx = 0; 1111 [].slice.call(document.querySelectorAll('a.tilter')).forEach(function(el, pos) { 1112 idx = pos%2 === 0 ? idx+1 : idx; 1113 new TiltFx(el, tiltSettings[idx-1]); 1114 }); 1115 } 1116 1117 init(); 1118 }); 1119 } ); 1120 //End execute javascript for distortion grid 1121 1122 //Start execute javascript for slider horizontal 1123 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-distortion-grid.default', function( $scope ) { 1124 Array.from(document.querySelectorAll('.distortion_grid_item-img')).forEach((el) => { 1125 const imgs = Array.from(el.querySelectorAll('img')); 1126 new hoverEffect({ 1127 parent: el, 1128 intensity: el.dataset.intensity || undefined, 1129 speedIn: el.dataset.speedin || undefined, 1130 speedOut: el.dataset.speedout || undefined, 1131 easing: el.dataset.easing || undefined, 1132 hover: el.dataset.hover || undefined, 1133 image1: imgs[0].getAttribute('src'), 1134 image2: imgs[1].getAttribute('src'), 1135 displacementImage: el.dataset.displacement 1136 }); 1137 }); 1138 } ); 1139 //End execute javascript for distortion grid 1140 1141 //Start execute javascript for slider property clip 1142 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-slider-property-clip.default', function( $scope ) { 1143 jQuery(".tg_slider_property_clip_wrapper").each(function() { 1144 var slider = jQuery(this).find(".slider"), 1145 slides = slider.find('li'), 1146 nav = slider.find('nav'); 1147 1148 slides.eq(0).addClass('current'); 1149 1150 nav.children('a').eq(0).addClass('current_dot'); 1151 1152 nav.on('click', 'a', function(event) { 1153 event.preventDefault(); 1154 $(this).addClass('current_dot').siblings().removeClass('current_dot'); 1155 slides.eq($(this).index()).addClass('current').removeClass('prev').siblings().removeClass('current'); 1156 slides.eq($(this).index()).prevAll().addClass('prev'); 1157 slides.eq($(this).index()).nextAll().removeClass('prev'); 1158 }); 1159 }); 1160 } ); 1161 //End execute javascript for slider property clip 1162 1163 //Start execute javascript for slider zoom 1164 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-slider-zoom.default', function( $scope ) { 1165 1166 jQuery(".slider_zoom_wrapper").each(function() { 1167 var sliderObj = jQuery(this); 1168 1169 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; }; }(); 1170 1171 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1172 1173 var $window = jQuery(window); 1174 var $body = jQuery('body'); 1175 1176 var Slideshow = function () { 1177 function Slideshow() { 1178 var _this = this; 1179 1180 var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1181 1182 _classCallCheck(this, Slideshow); 1183 1184 var timer = sliderObj.attr('data-autoplay'); 1185 var autoplay = true; 1186 1187 if(timer == 0) 1188 { 1189 timer = false; 1190 autoplay = false; 1191 } 1192 1193 var pagination = sliderObj.attr('data-pagination'); 1194 if(pagination == 0) 1195 { 1196 var pagination = false; 1197 } 1198 else 1199 { 1200 var pagination = true; 1201 } 1202 1203 var defaultOptions = { 1204 $el: sliderObj,
1205 showArrows: false, 1206 showPagination: false, 1207 duration: timer, 1208 autoplay: autoplay 1209 }; 1210 1211 var options = Object.assign({}, defaultOptions, userOptions); 1212 1213 this.$el = options.$el; 1214 this.maxSlide = this.$el.find($('.js-slider-home-slide')).length; 1215 this.showArrows = this.maxSlide > 1 ? options.showArrows : false; 1216 this.showPagination = pagination; 1217 this.currentSlide = 1; 1218 this.isAnimating = false; 1219 this.animationDuration = 1200; 1220 this.autoplaySpeed = options.duration; 1221 this.interval; 1222 this.$controls = this.$el.find('.js-slider-home-button'); 1223 this.autoplay = this.maxSlide > 1 ? options.autoplay : false; 1224 1225 this.$el.on('click', '.js-slider-home-next', function (event) { 1226 return _this.nextSlide(); 1227 }); 1228 this.$el.on('click', '.js-slider-home-prev', function (event) { 1229 return _this.prevSlide(); 1230 }); 1231 this.$el.on('click', '.js-pagination-item', function (event) { 1232 if (!_this.isAnimating) { 1233 _this.preventClick(); 1234 _this.goToSlide(event.target.dataset.slide); 1235 } 1236 }); 1237 1238 this.init(); 1239 } 1240 1241 _createClass(Slideshow, [{ 1242 key: 'init', 1243 value: function init() { 1244 this.goToSlide(1); 1245 1246 if (this.autoplay) { 1247 this.startAutoplay(); 1248 } 1249 1250 if (this.showPagination) { 1251 var paginationNumber = this.maxSlide; 1252 var pagination = '<div class="pagination"><div class="container">'; 1253 1254 for (var i = 0; i < this.maxSlide; i++) { 1255 var item = '<span class="pagination__item js-pagination-item ' + (i === 0 ? 'is-current' : '') + '" data-slide=' + (i + 1) + '>' + (i + 1) + '</span>'; 1256 pagination = pagination + item; 1257 } 1258 1259 pagination = pagination + '</div></div>'; 1260 1261 this.$el.append(pagination); 1262 } 1263 } 1264 }, { 1265 key: 'preventClick', 1266 value: function preventClick() { 1267 var _this2 = this; 1268 1269 this.isAnimating = true; 1270 this.$controls.prop('disabled', true); 1271 clearInterval(this.interval); 1272 1273 setTimeout(function () { 1274 _this2.isAnimating = false; 1275 _this2.$controls.prop('disabled', false); 1276 if (_this2.autoplay) { 1277 _this2.startAutoplay(); 1278 } 1279 }, this.animationDuration); 1280 } 1281 }, { 1282 key: 'goToSlide', 1283 value: function goToSlide(index) { 1284 this.currentSlide = parseInt(index); 1285 1286 if (this.currentSlide > this.maxSlide) { 1287 this.currentSlide = 1; 1288 } 1289 1290 if (this.currentSlide === 0) { 1291 this.currentSlide = this.maxSlide; 1292 } 1293 1294 var newCurrent = this.$el.find('.js-slider-home-slide[data-slide="' + this.currentSlide + '"]'); 1295 var newPrev = this.currentSlide === 1 ? this.$el.find('.js-slider-home-slide').last() : newCurrent.prev('.js-slider-home-slide'); 1296 var newNext = this.currentSlide === this.maxSlide ? this.$el.find('.js-slider-home-slide').first() : newCurrent.next('.js-slider-home-slide'); 1297 1298 this.$el.find('.js-slider-home-slide').removeClass('is-prev is-next is-current'); 1299 this.$el.find('.js-pagination-item').removeClass('is-current'); 1300 1301 if (this.maxSlide > 1) { 1302 newPrev.addClass('is-prev'); 1303 newNext.addClass('is-next'); 1304 } 1305 1306 newCurrent.addClass('is-current'); 1307 this.$el.find('.js-pagination-item[data-slide="' + this.currentSlide + '"]').addClass('is-current'); 1308 } 1309 }, { 1310 key: 'nextSlide', 1311 value: function nextSlide() { 1312 this.preventClick(); 1313 this.goToSlide(this.currentSlide + 1); 1314 } 1315 }, { 1316 key: 'prevSlide', 1317 value: function prevSlide() { 1318 this.preventClick(); 1319 this.goToSlide(this.currentSlide - 1); 1320 } 1321 }, { 1322 key: 'startAutoplay', 1323 value: function startAutoplay() { 1324 var _this3 = this; 1325 1326 this.interval = setInterval(function () { 1327 if (!_this3.isAnimating) { 1328 _this3.nextSlide(); 1329 } 1330 }, this.autoplaySpeed); 1331 } 1332 }, {
1333 key: 'destroy', 1334 value: function destroy() { 1335 this.$el.off(); 1336 } 1337 }]); 1338 1339 return Slideshow; 1340 }(); 1341 1342 (function () { 1343 var loaded = false; 1344 var maxLoad = 3000; 1345 1346 function load() { 1347 var options = { 1348 showPagination: true 1349 }; 1350 1351 var slideShow = new Slideshow(options); 1352 } 1353 1354 function addLoadClass() { 1355 $body.addClass('is-loaded'); 1356 1357 setTimeout(function () { 1358 $body.addClass('is-animated'); 1359 }, 600); 1360 } 1361 1362 $window.on('load', function () { 1363 if (!loaded) { 1364 loaded = true; 1365 load(); 1366 } 1367 }); 1368 1369 setTimeout(function () { 1370 if (!loaded) { 1371 loaded = true; 1372 load(); 1373 } 1374 }, maxLoad); 1375 1376 addLoadClass(); 1377 })(); 1378 }); 1379 } ); 1380 //End execute javascript for slider zoom 1381 1382 //Start execute javascript for slider parallax 1383 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-slider-parallax.default', function( $scope ) { 1384 1385 jQuery(".slider_parallax_wrapper").each(function() { 1386 var slideshow=jQuery(this); 1387 var timer = slideshow.attr('data-autoplay'); 1388 var autoplay = true; 1389 1390 if(timer == 0) 1391 { 1392 timer = false; 1393 autoplay = false; 1394 } 1395 1396 var pagination = slideshow.attr('data-pagination'); 1397 if(pagination == 0) 1398 { 1399 var pagination = false; 1400 } 1401 else 1402 { 1403 var pagination = true; 1404 } 1405 1406 var navigation = slideshow.attr('data-navigation'); 1407 if(navigation == 0) 1408 { 1409 var navigation = false; 1410 } 1411 else 1412 { 1413 var navigation = true; 1414 } 1415 1416 var slideshowDuration = timer; 1417 1418 function slideshowSwitch(slideshow,index,auto){ 1419 if(slideshow.data('wait')) return; 1420 1421 var slides = slideshow.find('.slide'); 1422 var pages = slideshow.find('.pagination'); 1423 var activeSlide = slides.filter('.is-active'); 1424 var activeSlideImage = activeSlide.find('.image-container'); 1425 var newSlide = slides.eq(index); 1426 var newSlideImage = newSlide.find('.image-container'); 1427 var newSlideContent = newSlide.find('.slide-content'); 1428 var newSlideElements=newSlide.find('.caption > *'); 1429 if(newSlide.is(activeSlide))return; 1430 1431 newSlide.addClass('is-new'); 1432 var timeout=slideshow.data('timeout'); 1433 clearTimeout(timeout); 1434 slideshow.data('wait',true); 1435 var transition=slideshow.attr('data-transition'); 1436 if(transition=='fade'){ 1437 newSlide.css({ 1438 display:'block', 1439 zIndex:2 1440 }); 1441 newSlideImage.css({ 1442 opacity:0 1443 }); 1444 1445 TweenMax.to(newSlideImage,1,{ 1446 alpha:1, 1447 onComplete:function(){ 1448 newSlide.addClass('is-active').removeClass('is-new'); 1449 activeSlide.removeClass('is-active'); 1450 newSlide.css({display:'',zIndex:''}); 1451 newSlideImage.css({opacity:''}); 1452 slideshow.find('.pagination').trigger('check'); 1453 slideshow.data('wait',false); 1454 if(auto){ 1455 timeout=setTimeout(function(){ 1456 slideshowNext(slideshow,false,true); 1457 },slideshowDuration); 1458 slideshow.data('timeout',timeout);}}}); 1459 } else { 1460 if(newSlide.index()>activeSlide.index()){ 1461 var newSlideRight=0; 1462 var newSlideLeft='auto'; 1463 var newSlideImageRight=-slideshow.width()/8; 1464 var newSlideImageLeft='auto'; 1465 var newSlideImageToRight=0; 1466 var newSlideImageToLeft='auto'; 1467 var newSlideContentLeft='auto'; 1468 var newSlideContentRight=0; 1469 var activeSlideImageLeft=-slideshow.width()/4; 1470 } else { 1471 var newSlideRight=''; 1472 var newSlideLeft=0; 1473 var newSlideImageRight='auto'; 1474 var newSlideImageLeft=-slideshow.width()/8; 1475 var newSlideImageToRight=''; 1476 var newSlideImageToLeft=0; 1477 var newSlideContentLeft=0; 1478 var newSlideContentRight='auto'; 1479 var activeSlideImageLeft=slideshow.width()/4; 1480 } 1481 1482 newSlide.css({ 1483 display:'block', 1484 width:0, 1485 right:newSlideRight, 1486 left:newSlideLeft 1487 ,zIndex:2 1488 }); 1489 1490 newSlideImage.css({ 1491 width:slideshow.width(),
1492 right:newSlideImageRight, 1493 left:newSlideImageLeft 1494 }); 1495 1496 newSlideContent.css({ 1497 width:slideshow.width(), 1498 left:newSlideContentLeft, 1499 right:newSlideContentRight 1500 }); 1501 1502 activeSlideImage.css({ 1503 left:0 1504 }); 1505 1506 TweenMax.set(newSlideElements,{y:20,force3D:true}); 1507 TweenMax.to(activeSlideImage,1,{ 1508 left:activeSlideImageLeft, 1509 ease:Power3.easeInOut 1510 }); 1511 1512 TweenMax.to(newSlide,1,{ 1513 width:slideshow.width(), 1514 ease:Power3.easeInOut 1515 }); 1516 1517 TweenMax.to(newSlideImage,1,{ 1518 right:newSlideImageToRight, 1519 left:newSlideImageToLeft, 1520 ease:Power3.easeInOut 1521 }); 1522 1523 TweenMax.staggerFromTo(newSlideElements,0.8,{alpha:0,y:60},{alpha:1,y:0,ease:Power3.easeOut,force3D:true,delay:0.6},0.1,function(){ 1524 newSlide.addClass('is-active').removeClass('is-new'); 1525 activeSlide.removeClass('is-active'); 1526 newSlide.css({ 1527 display:'', 1528 width:'', 1529 left:'', 1530 zIndex:'' 1531 }); 1532 1533 newSlideImage.css({ 1534 width:'', 1535 right:'', 1536 left:'' 1537 }); 1538 1539 newSlideContent.css({ 1540 width:'', 1541 left:'' 1542 }); 1543 1544 newSlideElements.css({ 1545 opacity:'', 1546 transform:'' 1547 }); 1548 1549 activeSlideImage.css({ 1550 left:'' 1551 }); 1552 1553 slideshow.find('.pagination').trigger('check'); 1554 slideshow.data('wait',false); 1555 if(auto){ 1556 timeout=setTimeout(function(){ 1557 slideshowNext(slideshow,false,true); 1558 },slideshowDuration); 1559 slideshow.data('timeout',timeout); 1560 } 1561 }); 1562 } 1563 } 1564 1565 function slideshowNext(slideshow,previous,auto){ 1566 var slides=slideshow.find('.slide'); 1567 var activeSlide=slides.filter('.is-active'); 1568 var newSlide=null; 1569 if(previous){ 1570 newSlide=activeSlide.prev('.slide'); 1571 if(newSlide.length === 0) { 1572 newSlide=slides.last(); 1573 } 1574 } else { 1575 newSlide=activeSlide.next('.slide'); 1576 if(newSlide.length==0) 1577 newSlide=slides.filter('.slide').first(); 1578 } 1579 1580 slideshowSwitch(slideshow,newSlide.index(),auto); 1581 } 1582 1583 function homeSlideshowParallax(){ 1584 var scrollTop=jQuery(window).scrollTop(); 1585 if(scrollTop>windowHeight) return; 1586 var inner=slideshow.find('.slideshow-inner'); 1587 var newHeight=windowHeight-(scrollTop/2); 1588 var newTop=scrollTop*0.8; 1589 1590 inner.css({ 1591 transform:'translateY('+newTop+'px)',height:newHeight 1592 }); 1593 } 1594 1595 jQuery(document).ready(function() { 1596 jQuery('.slider_parallax_wrapper .slide').addClass('is-loaded'); 1597 1598 jQuery('.slider_parallax_wrapper .arrows .arrow').on('click',function(){ 1599 slideshowNext(jQuery(this).closest('.slider_parallax_wrapper'),jQuery(this).hasClass('prev')); 1600 }); 1601 1602 jQuery('.slider_parallax_wrapper .pagination .item').on('click',function(){ 1603 slideshowSwitch(jQuery(this).closest('.slider_parallax_wrapper'),jQuery(this).index()); 1604 }); 1605 1606 jQuery('.slider_parallax_wrapper .pagination').on('check',function(){ 1607 var slideshow=jQuery(this).closest('.slider_parallax_wrapper'); 1608 var pages=jQuery(this).find('.item'); 1609 var index=slideshow.find('.slider_parallax_slides .is-active').index(); 1610 pages.removeClass('is-active'); 1611 pages.eq(index).addClass('is-active'); 1612 }); 1613 1614 if(autoplay) 1615 { 1616 var timeout=setTimeout(function(){ 1617 slideshowNext(slideshow,false,true); 1618 },slideshowDuration); 1619 1620 slideshow.data('timeout',timeout); 1621 } 1622 }); 1623 }); 1624 } ); 1625 //End execute javascript for slider parallax 1626 1627 1628 //Start execute javascript for navigation menu 1629 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-navigation-menu.default', function( $scope ) { 1630 jQuery('.tg_navigation_wrapper .nav li.menu-item').hover(function() 1631 { 1632 jQuery(this).children('ul:first').addClass('visible'); 1633 jQuery(this).children('ul:first').addClass('hover'); 1634 }, 1635 function() 1636 { 1637 jQuery(this).children('ul:first').removeClass('visible'); 1638 jQuery(this).children('ul:first').removeClass('hover'); 1639 }); 1640 1641 jQuery('.tg_navigation_wrapper .nav li.menu-item').children('ul:first.hover').hover(function() 1642 { 1643 jQuery(this).stop().addClass('visible'); 1644 }, 1645 function() 1646 { 1647 jQuery(this).stop().removeClass('visible'); 1648 }); 1649 } ); 1650 //End execute javascript for navigation menu 1651 1652 //Start execute javascript for mouse driven vertical carousel
1653 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-mouse-driven-vertical-carousel.default', function( $scope ) { 1654 1655 class VerticalMouseDrivenCarousel { 1656 constructor(options = {}) { 1657 const _defaults = { 1658 carousel: ".tg_mouse_driven_vertical_carousel_wrapper .js-carousel", 1659 bgImg: ".js-carousel-bg-img", 1660 list: ".js-carousel-list", 1661 listItem: ".js-carousel-list-item" 1662 }; 1663 1664 this.posY = 0; 1665 1666 this.defaults = Object.assign({}, _defaults, options); 1667 1668 this.initCursor(); 1669 this.init(); 1670 this.bgImgController(); 1671 } 1672 1673 //region getters 1674 getBgImgs() { 1675 return document.querySelectorAll(this.defaults.bgImg); 1676 } 1677 1678 getListItems() { 1679 return document.querySelectorAll(this.defaults.listItem); 1680 } 1681 1682 getList() { 1683 return document.querySelector(this.defaults.list); 1684 } 1685 1686 getCarousel() { 1687 return document.querySelector(this.defaults.carousel); 1688 } 1689 1690 init() { 1691 TweenMax.set(this.getBgImgs(), { 1692 autoAlpha: 0, 1693 scale: 1.05 1694 }); 1695 1696 TweenMax.set(this.getBgImgs()[0], { 1697 autoAlpha: 1, 1698 scale: 1 1699 }); 1700 1701 this.listItems = this.getListItems().length - 1; 1702 1703 this.listOpacityController(0); 1704 } 1705 1706 initCursor() { 1707 //Init only on desktop device 1708 if(jQuery(window).width()>1024) 1709 { 1710 const listHeight = this.getList().clientHeight; 1711 const carouselHeight = this.getCarousel().clientHeight; 1712 const carouselPos = this.getCarousel().getBoundingClientRect(); 1713 const carouselPosY = parseInt(carouselPos.top); 1714 1715 this.getCarousel().addEventListener( 1716 "mousemove", 1717 event => { 1718 this.posY = parseInt(event.pageY - carouselPosY) - this.getCarousel().offsetTop; 1719 let offset = -this.posY / carouselHeight * listHeight; 1720 1721 TweenMax.to(this.getList(), 0.3, { 1722 y: offset, 1723 ease: Power4.easeOut 1724 }); 1725 }, 1726 false 1727 ); 1728 } 1729 } 1730 1731 bgImgController() { 1732 for (const link of this.getListItems()) { 1733 link.addEventListener("mouseenter", ev => { 1734 let currentId = ev.currentTarget.dataset.itemId; 1735 1736 this.listOpacityController(currentId); 1737 1738 TweenMax.to(ev.currentTarget, 0.3, { 1739 autoAlpha: 1 1740 }); 1741 1742 TweenMax.to(".is-visible", 0.2, { 1743 autoAlpha: 0, 1744 scale: 1.05 1745 }); 1746 1747 if (!this.getBgImgs()[currentId].classList.contains("is-visible")) { 1748 this.getBgImgs()[currentId].classList.add("is-visible"); 1749 } 1750 1751 TweenMax.to(this.getBgImgs()[currentId], 0.6, { 1752 autoAlpha: 1, 1753 scale: 1 1754 }); 1755 }); 1756 } 1757 } 1758 1759 listOpacityController(id) { 1760 id = parseInt(id); 1761 let aboveCurrent = this.listItems - id; 1762 let belowCurrent = parseInt(id); 1763 1764 if (aboveCurrent > 0) { 1765 for (let i = 1; i <= aboveCurrent; i++) { 1766 let opacity = 0.5 / i; 1767 let offset = 5 * i; 1768 TweenMax.to(this.getListItems()[id + i], 0.5, { 1769 autoAlpha: opacity, 1770 x: offset, 1771 ease: Power3.easeOut 1772 }); 1773 } 1774 } 1775 1776 if (belowCurrent > 0) { 1777 for (let i = 0; i <= belowCurrent; i++) { 1778 let opacity = 0.5 / i; 1779 let offset = 5 * i; 1780 TweenMax.to(this.getListItems()[id - i], 0.5, { 1781 autoAlpha: opacity, 1782 x: offset, 1783 ease: Power3.easeOut 1784 }); 1785 } 1786 } 1787 } 1788 } 1789 1790 new VerticalMouseDrivenCarousel(); 1791 1792 } ); 1793 //End execute javascript for mouse driven vertical carousel 1794 1795 //Start execute javascript for synchronized carousel slider 1796 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-slider-synchronized-carousel.default', function( $scope ) { 1797 1798 jQuery(".tg_synchronized_carousel_slider_wrapper:not(.activated)").each(function() { 1799 var sliderID = jQuery(this).attr('id'); 1800 var slidersContainer = document.querySelector("#"+sliderID); 1801 var countSlide = jQuery(this).attr('data-countslide'); 1802 1803 // Initializing the numbers slider 1804 var msNumbers = new MomentumSlider({ 1805 el: slidersContainer, 1806 cssClass: "ms--numbers", 1807 range: [1, countSlide], 1808 rangeContent: function (i) { 1809 return "0" + i; 1810 }, 1811 style: { 1812 transform: [{scale: [0.4, 1]}], 1813 opacity: [0, 1] 1814 }, 1815 interactive: false 1816 }); 1817
1818 var titles = JSON.parse(jQuery(this).attr('data-slidetitles')); 1819 1820 var msTitles = new MomentumSlider({ 1821 el: slidersContainer, 1822 cssClass: "ms--titles", 1823 range: [0, parseInt(countSlide-1)], 1824 rangeContent: function (i) { 1825 return "<h3>"+ titles[i] +"</h3>"; 1826 }, 1827 vertical: true, 1828 reverse: true, 1829 style: { 1830 opacity: [0, 1] 1831 }, 1832 interactive: false 1833 }); 1834 1835 var buttonTitles = JSON.parse(jQuery(this).attr('data-slidebuttontitles')); 1836 var buttonUrls = JSON.parse(jQuery(this).attr('data-slidebuttonurls')); 1837 1838 // Initializing the links slider 1839 var msLinks = new MomentumSlider({ 1840 el: slidersContainer, 1841 cssClass: "ms--links", 1842 range: [0, parseInt(countSlide-1)], 1843 rangeContent: function (i) { 1844 return "<a href=\""+buttonUrls[i]+"\" class=\"ms-slide__link\">"+buttonTitles[i]+"</a>"; 1845 }, 1846 vertical: true, 1847 interactive: false 1848 }); 1849 1850 // Get pagination items 1851 var paginationID = jQuery(this).attr('data-pagination'); 1852 var pagination = document.querySelector("#"+paginationID); 1853 var paginationItems = [].slice.call(pagination.children); 1854 1855 var images = JSON.parse(jQuery(this).attr('data-slideimages')); 1856 1857 // Initializing the images slider 1858 var msImages = new MomentumSlider({ 1859 // Element to append the slider 1860 el: slidersContainer, 1861 // CSS class to reference the slider 1862 cssClass: "ms--images", 1863 // Generate the 4 slides required 1864 range: [0, parseInt(countSlide-1)], 1865 rangeContent: function (i) { 1866 return "<div class=\"ms-slide__image-container\"><div class=\"ms-slide__image\" style=\"background-image: url('"+images[i]+"')\"></div></div>"; 1867 }, 1868 // Syncronize the other sliders 1869 sync: [msNumbers, msTitles, msLinks], 1870 // Styles to interpolate as we move the slider 1871 style: { 1872 ".ms-slide__image": { 1873 transform: [{scale: [1.5, 1]}] 1874 } 1875 }, 1876 // Update pagination if slider change 1877 change: function(newIndex, oldIndex) { 1878 if (typeof oldIndex !== "undefined") { 1879 paginationItems[oldIndex].classList.remove("pagination__item--active"); 1880 } 1881 paginationItems[newIndex].classList.add("pagination__item--active"); 1882 } 1883 }); 1884 1885 pagination.addEventListener("click", function(e) { 1886 if (e.target.matches(".pagination__button")) { 1887 var index = paginationItems.indexOf(e.target.parentNode); 1888 msImages.select(index); 1889 } 1890 }); 1891 1892 jQuery(this).addClass('activated'); 1893 }); 1894 1895 } ); 1896 //End execute javascript for synchronized carousel slider 1897 1898 //Start execute javascript for flip box 1899 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-flip-box.default', function( $scope ) { 1900 1901 var countSquare = jQuery('.square').length; 1902 1903 //For each Square found add BG image 1904 for (i = 0; i < countSquare; i++) { 1905 var firstImage = jQuery('.square').eq([i]); 1906 var secondImage = jQuery('.square2').eq([i]); 1907 1908 var getImage = firstImage.attr('data-image'); 1909 var getImage2 = secondImage.attr('data-image'); 1910 1911 firstImage.css('background-image', 'url(' + getImage + ')'); 1912 secondImage.css('background-image', 'url(' + getImage2 + ')'); 1913 } 1914 1915 jQuery('.tg_flip_box_wrapper').on('click', function() { 1916 jQuery(this).trigger("mouseover"); 1917 }); 1918 1919 1920 } ); 1921 //End execute javascript for flip box 1922 1923 //Start execute javascript for animated text 1924 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-animated-text.default', function( $scope ) { 1925 1926 jQuery(".themegoods-animated-text").each(function() { 1927 var textContent = jQuery(this).first(); 1928 var delimiterTypeOri = jQuery(this).attr('data-delimiter'); 1929 var delimiterType = jQuery(this).attr('data-delimiter');
1930 var transitionSpeed = parseInt(jQuery(this).attr('data-transition')); 1931 var transitionDelay = parseInt(jQuery(this).attr('data-transition-delay')); 1932 var transitionDuration = parseInt(jQuery(this).attr('data-transition-duration')); 1933 1934 if(delimiterType == 'sentence') { 1935 delimiterType = 'word' 1936 } 1937 1938 var animatedText = textContent.blast({ 1939 delimiter: delimiterType, 1940 aria: false, 1941 }); 1942 1943 //If overflow hidden 1944 if(jQuery(this).hasClass('overflow-hidden')){ 1945 animatedText.each(function(i) { 1946 var textEachSpan = jQuery(this); 1947 var initialText = textEachSpan.text(); 1948 //console.log(textEachSpan.html()); 1949 textEachSpan.html('<span>'+initialText+'</span>'); 1950 1951 //console.log(initialText); 1952 }); 1953 } 1954 1955 if(textContent.isInViewport()) { 1956 animatedText.each(function(i) { 1957 var delaySpeed = parseInt(transitionDelay + (i * transitionSpeed)); 1958 //console.log(delimiterType); 1959 if(delimiterTypeOri == 'sentence') { 1960 delaySpeed = parseInt(transitionDelay + transitionSpeed); 1961 } 1962 1963 jQuery(this).queue(function (next) { 1964 jQuery(this).css({'transition-delay': delaySpeed+'ms', 'transition-duration': transitionDuration+'ms', 'transform': 'translateX(0px) translateY(0px) translateZ(0px)', 'opacity': 1}); 1965 }) 1966 }); 1967 } 1968 1969 jQuery(window).on('resize scroll', function() { 1970 if(textContent.isInViewport()) { 1971 animatedText.each(function(i) { 1972 var delaySpeed = parseInt(transitionDelay + (i * transitionSpeed)); 1973 if(delimiterTypeOri == 'sentence') { 1974 delaySpeed = parseInt(transitionDelay + transitionSpeed); 1975 } 1976 1977 jQuery(this).queue(function (next) { 1978 jQuery(this).css({'transition-delay': delaySpeed+'ms', 'transition-duration': transitionDuration+'ms', 'transform': 'translateX(0px) translateY(0px) translateZ(0px)', 'opacity': 1}); 1979 }) 1980 }); 1981 } 1982 }); 1983 }); 1984 1985 } ); 1986 //End execute javascript for animated text 1987 1988 //Start execute javascript for animated headline 1989 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-animated-headline.default', function( $scope ) { 1990 1991 jQuery(".themegoods-animated-headline").each(function() { 1992 var animationType = jQuery(this).attr('data-animation'); 1993 1994 jQuery(this).animatedHeadline({ 1995 animationType: animationType 1996 }); 1997 }); 1998 1999 } ); 2000 //End execute javascript for animated headline 2001 2002 //Start execute javascript for background menu effect 2003 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-background-menu-effect.default', function( $scope ) { 2004 2005 jQuery(".themegoods-background-menu-wrapper").each(function() { 2006 var menuWrapper = jQuery(this); 2007 var menuList = jQuery(this).find('.themegoods-background-menu li.themegoods-background-menu__item a'); 2008 2009 menuList.each(function() { 2010 jQuery(this).mouseenter(function() { 2011 2012 jQuery(this).parent('li').addClass('mouseover'); 2013 jQuery(this).parent('li').removeClass('mouseleave'); 2014 2015 }).mouseleave(function() { 2016 2017 jQuery(this).parent('li').addClass('mouseleave'); 2018 jQuery(this).parent('li').removeClass('mouseover'); 2019 2020 if(menuWrapper.attr('display-default') == 'yes') { 2021 var hasMouseOver = false; 2022 menuList.each(function() { 2023 if(jQuery(this).hasClass('mouseover')) { 2024 hasMouseOver = true; 2025 } 2026 }); 2027 2028 if(!hasMouseOver) { 2029 menuWrapper.find('.themegoods-background-menu li:first').removeClass('mouseleave'); 2030 menuWrapper.find('.themegoods-background-menu li:first').addClass('mouseover'); 2031 } 2032 } 2033 }); 2034 }); 2035 2036 if(menuWrapper.attr('display-default') == 'yes') { 2037 menuWrapper.find('.themegoods-background-menu li:first').addClass('mouseover'); 2038 } 2039 }); 2040 2041 } ); 2042 //End execute javascript for background menu effect 2043 2044 //Start execute javascript for service grid 2045 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-service-grid.default', function( $scope ) { 2046 2047 jQuery(".service-grid-wrapper").mouseover(function() { 2048 2049 var dataHoverY = jQuery(this).attr('data-hoverY'); 2050 jQuery(this).find('.header-wrap').css('transform', 'translateY(-'+dataHoverY+'px)'); 2051 2052 }).mouseleave(function() { 2053 2054 jQuery(this).find('.header-wrap').css('transform', 'translateY(0px)'); 2055 }); 2056 2057 jQuery(".service-grid-wrapper").each(function() { 2058 var hoverContent = jQuery(this).find('.hover-content'); 2059 var hoverMoveY = parseInt(hoverContent.height()-20); 2060 jQuery(this).attr('data-hoverY', hoverMoveY); 2061 }); 2062 2063 jQuery(window).resize(function() { 2064 jQuery(".service-grid-wrapper").each(function() { 2065 var hoverContent = jQuery(this).find('.hover-content'); 2066 var hoverMoveY = parseInt(hoverContent.height()-20); 2067 jQuery(this).attr('data-hoverY', hoverMoveY); 2068 }); 2069 }); 2070 2071 } ); 2072 //End execute javascript for service grid 2073 2074 //Start execute javascript for service carousel
2075 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-service-carousel.default', function( $scope ) { 2076 jQuery(".service-carousel-wrapper .owl-carousel").each(function() { 2077 var autoPlay = jQuery(this).attr('data-autoplay'); 2078 if (typeof autoPlay == "undefined"){ 2079 autoPlay = false; 2080 } 2081 if(autoPlay == 1) 2082 { 2083 autoPlay = true; 2084 } 2085 else 2086 { 2087 autoPlay = false; 2088 } 2089 2090 var timer = parseInt(jQuery(this).attr('data-timer')); 2091 if (typeof timer == "undefined"){ 2092 timer = 8000; 2093 } 2094 2095 var slidePadding = parseInt(jQuery(this).attr('data-stage-padding')); 2096 if (typeof slidePadding == "undefined"){ 2097 slidePadding = 70; 2098 } 2099 2100 var slideMargin = parseInt(jQuery(this).attr('data-margin')); 2101 if (typeof slideMargin == "undefined"){ 2102 slideMargin = 40; 2103 } 2104 2105 var items = parseInt(jQuery(this).attr('data-items')); 2106 if (typeof items == "undefined"){ 2107 items = 4; 2108 } 2109 2110 var pagination = jQuery(this).attr('data-pagination'); 2111 if (typeof pagination == "undefined"){ 2112 pagination = true; 2113 } 2114 if(pagination == 1) 2115 { 2116 pagination = true; 2117 } 2118 else 2119 { 2120 pagination = false; 2121 } 2122 //console.log(pagination); 2123 var serviceCarousel = jQuery(this).owlCarousel({ 2124 stagePadding: parseInt(slidePadding), 2125 loop: false, 2126 center: false, 2127 items: parseInt(items), 2128 margin: parseInt(slideMargin), 2129 autoHeight : true, 2130 autoplay: autoPlay, 2131 dots: pagination, 2132 autoplayTimeout: timer, 2133 smartSpeed: 450, 2134 responsive: { 2135 0: { 2136 items: 1 2137 }, 2138 768: { 2139 items: 2 2140 }, 2141 1170: { 2142 items: parseInt(items) 2143 }, 2144 1600: { 2145 items: parseInt(items+1) 2146 }, 2147 2000: { 2148 items: parseInt(items+2) 2149 }, 2150 2400: { 2151 items: parseInt(items+3) 2152 }, 2153 } 2154 }); 2155 2156 setTimeout(function(){ 2157 serviceCarousel.trigger('refresh.owl.carousel'); 2158 }, 1000); 2159 }); 2160 }); 2161 //End execute javascript for service carousel 2162 2163 //Start execute javascript for testimonials carousel 2164 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-testimonial-carousel.default', function( $scope ) { 2165 jQuery(".testimonials-carousel-wrapper .owl-carousel").each(function() { 2166 var autoPlay = jQuery(this).attr('data-autoplay'); 2167 if (typeof autoPlay == "undefined"){ 2168 autoPlay = false; 2169 } 2170 if(autoPlay == 1) 2171 { 2172 autoPlay = true; 2173 } 2174 else 2175 { 2176 autoPlay = false; 2177 } 2178 2179 var timer = jQuery(this).attr('data-timer'); 2180 if (typeof timer == "undefined"){ 2181 timer = 8000; 2182 } 2183 2184 var pagination = jQuery(this).attr('data-pagination'); 2185 if (typeof pagination == "undefined"){ 2186 pagination = true; 2187 } 2188 if(pagination == 1) 2189 { 2190 pagination = true; 2191 } 2192 else 2193 { 2194 pagination = false; 2195 } 2196 2197 jQuery(this).owlCarousel({ 2198 loop: false, 2199 center: true, 2200 items: 3, 2201 margin: 0, 2202 autoplay: autoPlay, 2203 dots:pagination, 2204 autoplayTimeout: timer, 2205 smartSpeed: 450, 2206 responsive: { 2207 0: { 2208 items: 1 2209 }, 2210 768: { 2211 items: 2 2212 }, 2213 1170: { 2214 items: 3 2215 } 2216 } 2217 }); 2218 }); 2219 }); 2220 //End execute javascript for testimonials carousel 2221 2222 //Start execute javascript for accommodation carousel 2223 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-accommodation-carousel.default', function( $scope ) { 2224 jQuery(".accommodation-carousel-wrapper .owl-carousel").each(function() { 2225 var autoPlay = jQuery(this).attr('data-autoplay'); 2226 if (typeof autoPlay == "undefined"){ 2227 autoPlay = false; 2228 } 2229 if(autoPlay == 1) 2230 { 2231 autoPlay = true; 2232 } 2233 else 2234 { 2235 autoPlay = false; 2236 } 2237 2238 var timer = jQuery(this).attr('data-timer'); 2239 if (typeof timer == "undefined"){ 2240 timer = 8000; 2241 } 2242 2243 var pagination = jQuery(this).attr('data-pagination'); 2244 if (typeof pagination == "undefined"){ 2245 pagination = true; 2246 } 2247 if(pagination == 1) 2248 { 2249 pagination = true; 2250 } 2251 else 2252 { 2253 pagination = false;
2254 } 2255 2256 var items = jQuery(this).attr('data-items'); 2257 if (typeof pagination == "undefined"){ 2258 items = 2; 2259 } 2260 2261 //console.log(pagination); 2262 jQuery(this).owlCarousel({ 2263 stagePadding: 70, 2264 loop: false, 2265 center: false, 2266 items: parseInt(items), 2267 margin: 40, 2268 autoplay: autoPlay, 2269 dots:pagination, 2270 autoplayTimeout: timer, 2271 smartSpeed: 450, 2272 responsive: { 2273 0: { 2274 items: 1 2275 }, 2276 768: { 2277 items: 2 2278 }, 2279 1170: { 2280 items: parseInt(items) 2281 } 2282 } 2283 }); 2284 }); 2285 }); 2286 //End execute javascript for accommodation carousel 2287 2288 //Start execute javascript for Elementor image 2289 elementorFrontend.hooks.addAction( 'frontend/element_ready/image.default', function( $scope ) { 2290 2291 if(elementorFrontend.isEditMode()) 2292 { 2293 var elementSettings = {}; 2294 var modelCID = $scope.data( 'model-cid' ); 2295 2296 var settings = elementorFrontend.config.elements.data[ modelCID ]; 2297 if(typeof settings != 'undefined') 2298 { 2299 var type = settings.attributes.widgetType || settings.attributes.elType, 2300 settingsKeys = elementorFrontend.config.elements.keys[ type ]; 2301 2302 if ( ! settingsKeys ) { 2303 settingsKeys = elementorFrontend.config.elements.keys[type] = []; 2304 2305 jQuery.each( settings.controls, function ( name, control ) { 2306 if ( control.frontend_available ) { 2307 settingsKeys.push( name ); 2308 } 2309 }); 2310 } 2311 2312 jQuery.each( settings.getActiveControls(), function( controlKey ) { 2313 if ( -1 !== settingsKeys.indexOf( controlKey ) ) { 2314 elementSettings[ controlKey ] = settings.attributes[ controlKey ]; 2315 } 2316 } ); 2317 2318 var widgetExt = elementSettings; 2319 } 2320 } 2321 else 2322 { 2323 //Get widget settings data 2324 var widgetExtObj = $scope.attr('data-settings'); 2325 2326 if(typeof widgetExtObj != 'undefined') 2327 { 2328 var widgetExt = JSON.parse(widgetExtObj); 2329 } 2330 } 2331 2332 if(typeof widgetExt != 'undefined') 2333 { 2334 //Begin background image parallax scrolling 2335 if(widgetExt.hoteller_image_is_animation == 'true') 2336 { 2337 $scope.addClass('themegoods-image-animation-'+widgetExt.hoteller_image_animation_effect); 2338 2339 $scope.smoove({ 2340 offset : '30%' 2341 }); 2342 } 2343 } 2344 } ); 2345 //End execute javascript for Elementor image 2346 2347 //Start execute javascript for testimonials slider 2348 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-testimonial-slider.default', function( $scope ) { 2349 jQuery(".testimonials-slider-wrapper .owl-carousel").each(function() { 2350 var autoPlay = jQuery(this).attr('data-autoplay'); 2351 if (typeof autoPlay == "undefined"){ 2352 autoPlay = false; 2353 } 2354 if(autoPlay == 1) 2355 { 2356 autoPlay = true; 2357 } 2358 else 2359 { 2360 autoPlay = false; 2361 } 2362 2363 var timer = jQuery(this).attr('data-timer'); 2364 if (typeof timer == "undefined"){ 2365 timer = 8000; 2366 } 2367 2368 jQuery(this).owlCarousel({ 2369 loop: false, 2370 center: true, 2371 margin: 0, 2372 nav:true, 2373 autoplay: autoPlay, 2374 autoplayTimeout: timer, 2375 smartSpeed: 300, 2376 navText: [ '<span class="arrow-left"></span>', '<span class="arrow-right"></span>' ], 2377 responsive:{ 2378 0:{ 2379 items:1 2380 }, 2381 600:{ 2382 items:1 2383 }, 2384 800:{ 2385 items:1 2386 }, 2387 1024:{ 2388 items:1 2389 } 2390 } 2391 }); 2392 }); 2393 }); 2394 //End execute javascript for testimonials slider 2395 2396 2397 //Start execute javascript for slider image carousel 2398 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-slider-image-carousel.default', function( $scope ) { 2399 jQuery(".tg_image_carousel_slider_wrapper").each(function() { 2400 jQuery(this).find('.carousel-item').eq(0).addClass('active'); 2401 var total = jQuery(this).find('.carousel-item').length; 2402 var current = 0; 2403 var slideObj = jQuery(this); 2404 2405 jQuery(this).find('#moveRight').on('click', function(){ 2406 var next=current; 2407 current= current+1; 2408 setSlide(next, current, slideObj); 2409 }); 2410 jQuery(this).find('#moveLeft').on('click', function(){ 2411 var prev=current; 2412 current = current- 1; 2413 setSlide(prev, current, slideObj); 2414 }); 2415 function setSlide(prev, next, slideObj){ 2416 var slide= current; 2417 if(next>total-1){ 2418 slide=0; 2419 current=0; 2420 } 2421 if(next<0){ 2422 slide=total - 1; 2423 current=total - 1; 2424 } 2425 2426 slideObj.find('.carousel-item').eq(prev).removeClass('active'); 2427 slideObj.find('.carousel-item').eq(slide).addClass('active'); 2428 setTimeout(function(){ 2429 2430 },800); 2431 } 2432 }); 2433 } ); 2434 //End execute javascript for slider image carousel
2435 2436 //Start execute javascript for search 2437 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-search.default', function( $scope ) { 2438 2439 jQuery(".hoteller-search-icon").each(function() { 2440 var iconInput = jQuery(this).find('a'); 2441 2442 iconInput.bind('click', function () { 2443 var openDiv = jQuery(this).attr('data-open'); 2444 jQuery('#'+openDiv).addClass('active'); 2445 2446 var isTouch = ('ontouchstart' in document.documentElement); 2447 if ( isTouch ) { 2448 jQuery('#'+openDiv).find('.hoteller-search-inner').addClass('touch'); 2449 } 2450 2451 jQuery('body').addClass('elementor-no-overflow'); 2452 jQuery('body').addClass('elementor-search-activate'); 2453 2454 setTimeout(function(){ 2455 jQuery('#'+openDiv).find('.tg_search_form.autocomplete_form').find('input#s').trigger('focus'); 2456 }, 300); 2457 }); 2458 }); 2459 2460 jQuery(".tg_search_form.autocomplete_form").each(function() { 2461 var wrapper = jQuery(this).attr('data-open'); 2462 var formInput = jQuery(this).find('input[name="s"]'); 2463 var resultDiv = jQuery(this).attr('data-result'); 2464 var isTouch = ('ontouchstart' in document.documentElement); 2465 2466 if ( !isTouch ) { 2467 formInput.on('input', function() { 2468 if(jQuery(this).val().length > 1) 2469 { 2470 jQuery.ajax({ 2471 url: tgAjax.ajaxurl, 2472 type:'POST', 2473 data:'action=hoteller_ajax_search_result&'+jQuery(this).serialize(), 2474 success:function(results) { 2475 jQuery("#"+resultDiv).html(results); 2476 2477 if(results != '') 2478 { 2479 jQuery("#"+resultDiv).addClass('visible'); 2480 jQuery("#"+resultDiv).show(); 2481 jQuery("#"+resultDiv).css('z-index', 99); 2482 2483 jQuery("#"+resultDiv+ " ul li a").mousedown(function() { 2484 jQuery("#"+resultDiv).addClass('visible'); 2485 jQuery("#"+resultDiv).attr('data-mousedown', 'true'); 2486 2487 location.href = jQuery(this).attr('href'); 2488 }); 2489 } 2490 else 2491 { 2492 jQuery("#"+resultDiv).hide(); 2493 } 2494 } 2495 }); 2496 } 2497 else 2498 { 2499 jQuery("#"+resultDiv).html(''); 2500 } 2501 }); 2502 } 2503 2504 formInput.bind('click', function () { 2505 jQuery("#"+resultDiv).addClass('visible'); 2506 jQuery("#"+resultDiv).attr('data-mousedown', 'true'); 2507 2508 /*var isTouch = ('ontouchstart' in document.documentElement); 2509 if ( isTouch ) {*/ 2510 //jQuery('#'+wrapper).addClass('touch'); 2511 //} 2512 }); 2513 2514 formInput.bind('focus', function () { 2515 jQuery("#"+resultDiv).addClass('visible'); 2516 formInput.addClass('visible'); 2517 }); 2518 2519 formInput.bind('blur', function () { 2520 jQuery("#"+resultDiv).removeClass('visible'); 2521 formInput.removeClass('visible'); 2522 }); 2523 2524 jQuery("#"+wrapper).bind('click', function () { 2525 if(!formInput.hasClass('visible')) 2526 { 2527 if(jQuery("#"+resultDiv).attr('data-mousedown') != 'true') 2528 { 2529 jQuery("#"+resultDiv).removeClass('visible'); 2530 } 2531 jQuery('#'+wrapper).removeClass('active'); 2532 jQuery('body').removeClass('elementor-no-overflow'); 2533 jQuery('body').removeClass('elementor-search-activate'); 2534 } 2535 }); 2536 }); 2537 2538 } ); 2539 //End execute javascript for search 2540 2541 //Start execute javascript for portfolio timeline 2542 elementorFrontend.hooks.addAction( 'frontend/element_ready/hoteller-portfolio-timeline.default', function( $scope ) { 2543 var timelines = jQuery('.cd-horizontal-timeline'), 2544 eventsMinDistance = 120; 2545 2546 (timelines.length > 0) && initTimeline(timelines); 2547 2548 function initTimeline(timelines) { 2549 timelines.each(function(){ 2550 var timeline = jQuery(this), 2551 timelineComponents = {}; 2552 //cache timeline components 2553 timelineComponents['timelineWrapper'] = timeline.find('.events-wrapper'); 2554 timelineComponents['eventsWrapper'] = timelineComponents['timelineWrapper'].children('.events'); 2555 timelineComponents['fillingLine'] = timelineComponents['eventsWrapper'].children('.filling-line'); 2556 timelineComponents['timelineEvents'] = timelineComponents['eventsWrapper'].find('a'); 2557 timelineComponents['timelineDates'] = parseDate(timelineComponents['timelineEvents']); 2558 timelineComponents['eventsMinLapse'] = minLapse(timelineComponents['timelineDates']); 2559 timelineComponents['timelineNavigation'] = timeline.find('.cd-timeline-navigation'); 2560 timelineComponents['eventsContent'] = timeline.children('.events-content'); 2561 2562 //assign a left postion to the single events along the timeline 2563 setDatePosition(timelineComponents, eventsMinDistance); 2564 //assign a width to the timeline 2565 var timelineTotWidth = setTimelineWidth(timelineComponents, eventsMinDistance); 2566 //the timeline has been initialize - show it 2567 timeline.addClass('loaded'); 2568 2569 //detect click on the next arrow 2570 timelineComponents['timelineNavigation'].on('click', '.next', function(event){ 2571 event.preventDefault(); 2572 updateSlide(timelineComponents, timelineTotWidth, 'next'); 2573 }); 2574 //detect click on the prev arrow 2575 timelineComponents['timelineNavigation'].on('click', '.prev', function(event){ 2576 event.preventDefault(); 2577 updateSlide(timelineComponents, timelineTotWidth, 'prev'); 2578 }); 2579 //detect click on the a single event - show new event content 2580 timelineComponents['eventsWrapper'].on('click', 'a', function(event){ 2581 event.preventDefault(); 2582 timelineComponents['timelineEvents'].removeClass('selected'); 2583 jQuery(this).addClass('selected'); 2584 updateOlderEvents(jQuery(this)); 2585 updateFilling(jQuery(this), timelineComponents['fillingLine'], timelineTotWidth); 2586 updateVisibleContent(jQuery(this), timelineComponents['eventsContent']); 2587 }); 2588 2589 //on swipe, show next/prev event content 2590 timelineComponents['eventsContent'].on('swipeleft', function(){ 2591 var mq = checkMQ(); 2592 ( mq == 'mobile' ) && showNewContent(timelineComponents, timelineTotWidth, 'next'); 2593 }); 2594 timelineComponents['eventsContent'].on('swiperight', function(){ 2595 var mq = checkMQ(); 2596 ( mq == 'mobile' ) && showNewContent(timelineComponents, timelineTotWidth, 'prev'); 2597 }); 2598 2599 //keyboard navigation 2600 jQuery(document).keyup(function(event){ 2601 if(event.which=='37' && elementInViewport(timeline.get(0)) ) { 2602 showNewContent(timelineComponents, timelineTotWidth, 'prev'); 2603 } else if( event.which=='39' && elementInViewport(timeline.get(0))) { 2604 showNewContent(timelineComponents, timelineTotWidth, 'next'); 2605 } 2606 }); 2607 }); 2608 } 2609 2610 function updateSlide(timelineComponents, timelineTotWidth, string) { 2611 //retrieve translateX value of timelineComponents['eventsWrapper'] 2612 var translateValue = getTranslateValue(timelineComponents['eventsWrapper']),
2613 wrapperWidth = Number(timelineComponents['timelineWrapper'].css('width').replace('px', '')); 2614 //translate the timeline to the left('next')/right('prev') 2615 (string == 'next') 2616 ? translateTimeline(timelineComponents, translateValue - wrapperWidth + eventsMinDistance, wrapperWidth - timelineTotWidth) 2617 : translateTimeline(timelineComponents, translateValue + wrapperWidth - eventsMinDistance); 2618 } 2619 2620 function showNewContent(timelineComponents, timelineTotWidth, string) { 2621 //go from one event to the next/previous one 2622 var visibleContent = timelineComponents['eventsContent'].find('.selected'), 2623 newContent = ( string == 'next' ) ? visibleContent.next() : visibleContent.prev(); 2624 2625 if ( newContent.length > 0 ) { //if there's a next/prev event - show it 2626 var selectedDate = timelineComponents['eventsWrapper'].find('.selected'), 2627 newEvent = ( string == 'next' ) ? selectedDate.parent('li').next('li').children('a') : selectedDate.parent('li').prev('li').children('a'); 2628 2629 updateFilling(newEvent, timelineComponents['fillingLine'], timelineTotWidth); 2630 updateVisibleContent(newEvent, timelineComponents['eventsContent']); 2631 newEvent.addClass('selected'); 2632 selectedDate.removeClass('selected'); 2633 updateOlderEvents(newEvent); 2634 updateTimelinePosition(string, newEvent, timelineComponents, timelineTotWidth); 2635 } 2636 } 2637 2638 function updateTimelinePosition(string, event, timelineComponents, timelineTotWidth) { 2639 //translate timeline to the left/right according to the position of the selected event 2640 var eventStyle = window.getComputedStyle(event.get(0), null), 2641 eventLeft = Number(eventStyle.getPropertyValue("left").replace('px', '')), 2642 timelineWidth = Number(timelineComponents['timelineWrapper'].css('width').replace('px', '')), 2643 timelineTotWidth = Number(timelineComponents['eventsWrapper'].css('width').replace('px', '')); 2644 var timelineTranslate = getTranslateValue(timelineComponents['eventsWrapper']); 2645 2646 if( (string == 'next' && eventLeft > timelineWidth - timelineTranslate) || (string == 'prev' && eventLeft < - timelineTranslate) ) { 2647 translateTimeline(timelineComponents, - eventLeft + timelineWidth/2, timelineWidth - timelineTotWidth); 2648 } 2649 } 2650 2651 function translateTimeline(timelineComponents, value, totWidth) { 2652 var eventsWrapper = timelineComponents['eventsWrapper'].get(0); 2653 value = (value > 0) ? 0 : value; //only negative translate value 2654 value = ( !(typeof totWidth === 'undefined') && value < totWidth ) ? totWidth : value; //do not translate more than timeline width 2655 setTransformValue(eventsWrapper, 'translateX', value+'px'); 2656 //update navigation arrows visibility 2657 (value == 0 ) ? timelineComponents['timelineNavigation'].find('.prev').addClass('inactive') : timelineComponents['timelineNavigation'].find('.prev').removeClass('inactive'); 2658 (value == totWidth ) ? timelineComponents['timelineNavigation'].find('.next').addClass('inactive') : timelineComponents['timelineNavigation'].find('.next').removeClass('inactive'); 2659 } 2660 2661 function updateFilling(selectedEvent, filling, totWidth) { 2662 //change .filling-line length according to the selected event 2663 var eventStyle = window.getComputedStyle(selectedEvent.get(0), null), 2664 eventLeft = eventStyle.getPropertyValue("left"), 2665 eventWidth = eventStyle.getPropertyValue("width"); 2666 eventLeft = Number(eventLeft.replace('px', '')) + Number(eventWidth.replace('px', ''))/2; 2667 var scaleValue = eventLeft/totWidth; 2668 setTransformValue(filling.get(0), 'scaleX', scaleValue); 2669 } 2670 2671 function setDatePosition(timelineComponents, min) { 2672 for (i = 0; i < timelineComponents['timelineDates'].length; i++) { 2673 var distance = daydiff(timelineComponents['timelineDates'][0], timelineComponents['timelineDates'][i]), 2674 distanceNorm = Math.round(distance/timelineComponents['eventsMinLapse']) + 2; 2675 timelineComponents['timelineEvents'].eq(i).css('left', distanceNorm*min+'px'); 2676 } 2677 } 2678 2679 function setTimelineWidth(timelineComponents, width) { 2680 var timeSpan = daydiff(timelineComponents['timelineDates'][0], timelineComponents['timelineDates'][timelineComponents['timelineDates'].length-1]), 2681 timeSpanNorm = timeSpan/timelineComponents['eventsMinLapse'], 2682 timeSpanNorm = Math.round(timeSpanNorm) + 4, 2683 totalWidth = timeSpanNorm*width; 2684 timelineComponents['eventsWrapper'].css('width', totalWidth+'px'); 2685 updateFilling(timelineComponents['timelineEvents'].eq(0), timelineComponents['fillingLine'], totalWidth); 2686 2687 return totalWidth; 2688 } 2689 2690 function updateVisibleContent(event, eventsContent) { 2691 var eventDate = event.data('date'), 2692 visibleContent = eventsContent.find('.selected'), 2693 selectedContent = eventsContent.find('[data-date="'+ eventDate +'"]'), 2694 selectedContentHeight = selectedContent.height(); 2695 2696 if (selectedContent.index() > visibleContent.index()) { 2697 var classEnetering = 'selected enter-right', 2698 classLeaving = 'leave-left'; 2699 } else { 2700 var classEnetering = 'selected enter-left', 2701 classLeaving = 'leave-right'; 2702 } 2703 2704 selectedContent.attr('class', classEnetering); 2705 visibleContent.attr('class', classLeaving).one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function(){ 2706 visibleContent.removeClass('leave-right leave-left'); 2707 selectedContent.removeClass('enter-left enter-right'); 2708 }); 2709 eventsContent.css('height', selectedContentHeight+'px'); 2710 } 2711 2712 function updateOlderEvents(event) { 2713 event.parent('li').prevAll('li').children('a').addClass('older-event').end().end().nextAll('li').children('a').removeClass('older-event'); 2714 } 2715 2716 function getTranslateValue(timeline) { 2717 var timelineStyle = window.getComputedStyle(timeline.get(0), null), 2718 timelineTranslate = timelineStyle.getPropertyValue("-webkit-transform") || 2719 timelineStyle.getPropertyValue("-moz-transform") || 2720 timelineStyle.getPropertyValue("-ms-transform") || 2721 timelineStyle.getPropertyValue("-o-transform") || 2722 timelineStyle.getPropertyValue("transform"); 2723 2724 if( timelineTranslate.indexOf('(') >=0 ) { 2725 var timelineTranslate = timelineTranslate.split('(')[1]; 2726 timelineTranslate = timelineTranslate.split(')')[0]; 2727 timelineTranslate = timelineTranslate.split(','); 2728 var translateValue = timelineTranslate[4]; 2729 } else { 2730 var translateValue = 0; 2731 } 2732 2733 return Number(translateValue); 2734 } 2735 2736 function setTransformValue(element, property, value) { 2737 element.style["-webkit-transform"] = property+"("+value+")"; 2738 element.style["-moz-transform"] = property+"("+value+")"; 2739 element.style["-ms-transform"] = property+"("+value+")"; 2740 element.style["-o-transform"] = property+"("+value+")"; 2741 element.style["transform"] = property+"("+value+")"; 2742 } 2743 2744 //based on http://stackoverflow.com/questions/542938/how-do-i-get-the-number-of-days-between-two-dates-in-javascript 2745 function parseDate(events) { 2746 var dateArrays = []; 2747 events.each(function(){ 2748 var dateComp = jQuery(this).data('date').split('/'), 2749 newDate = new Date(dateComp[2], dateComp[1]-1, dateComp[0]); 2750 dateArrays.push(newDate); 2751 }); 2752 return dateArrays; 2753 } 2754 2755 function parseDate2(events) { 2756 var dateArrays = []; 2757 events.each(function(){ 2758 var singleDate = jQuery(this), 2759 dateComp = singleDate.data('date').split('T'); 2760 if( dateComp.length > 1 ) { //both DD/MM/YEAR and time are provided 2761 var dayComp = dateComp[0].split('/'), 2762 timeComp = dateComp[1].split(':'); 2763 } else if( dateComp[0].indexOf(':') >=0 ) { //only time is provide 2764 var dayComp = ["2000", "0", "0"], 2765 timeComp = dateComp[0].split(':'); 2766 } else { //only DD/MM/YEAR 2767 var dayComp = dateComp[0].split('/'), 2768 timeComp = ["0", "0"]; 2769 } 2770 var newDate = new Date(dayComp[2], dayComp[1]-1, dayComp[0], timeComp[0], timeComp[1]); 2771 dateArrays.push(newDate); 2772 }); 2773 return dateArrays; 2774 } 2775 2776 function daydiff(first, second) { 2777 return Math.round((second-first)); 2778 } 2779 2780 function minLapse(dates) { 2781 //determine the minimum distance among events 2782 var dateDistances = []; 2783 for (i = 1; i < dates.length; i++) { 2784 var distance = daydiff(dates[i-1], dates[i]); 2785 dateDistances.push(distance); 2786 } 2787 return Math.min.apply(null, dateDistances); 2788 } 2789 2790 /* 2791 How to tell if a DOM element is visible in the current viewport? 2792 http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport 2793 */ 2794 function elementInViewport(el) { 2795 var top = el.offsetTop; 2796 var left = el.offsetLeft; 2797 var width = el.offsetWidth; 2798 var height = el.offsetHeight; 2799 2800 while(el.offsetParent) { 2801 el = el.offsetParent; 2802 top += el.offsetTop; 2803 left += el.offsetLeft; 2804 } 2805 2806 return ( 2807 top < (window.pageYOffset + window.innerHeight) && 2808 left < (window.pageXOffset + window.innerWidth) && 2809 (top + height) > window.pageYOffset && 2810 (left + width) > window.pageXOffset 2811 ); 2812 } 2813 2814 function checkMQ() { 2815 //check if mobile or desktop device 2816 return window.getComputedStyle(document.querySelector('.cd-horizontal-timeline'), '::before').getPropertyValue('content').replace(/'/g, "").replace(/"/g, ""); 2817 } 2818 } ); 2819 //End execute javascript for portfolio timeline vertical 2820 2821 } ); 2822 2823} )( 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.