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