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