1var SALA = SALA || {}; 2 3(function ($) { 4 "use strict"; 5 6 function isInViewport(node) { 7 let rect = node.getBoundingClientRect() 8 return ( 9 (rect.height > 0 || rect.width > 0) && 10 rect.bottom >= 0 && 11 rect.right >= 0 && 12 rect.top <= (window.innerHeight || document.documentElement.clientHeight) && 13 rect.left <= (window.innerWidth || document.documentElement.clientWidth) 14 ) 15 } 16 17 SALA.element = { 18 init: function() { 19 SALA.element.swiper(); 20 SALA.element.tabs(); 21 SALA.element.modern_tabs(); 22 SALA.element.accordion(); 23 SALA.element.scroll_top(); 24 SALA.element.header(); 25 SALA.element.main_menu(); 26 SALA.element.portfolio_isotope(); 27 SALA.element.dark_light_switcher(); 28 SALA.element.nice_select(); 29 SALA.element.nouislider(); 30 SALA.element.zoom_image(); 31 SALA.element.input_number(); 32 SALA.element.reviews(); 33 SALA.element.checkout(); 34 SALA.element.section_pricing(); 35 SALA.element.section_table(); 36 SALA.element.section_counter(); 37 SALA.element.form(); 38 SALA.element.row(); 39 SALA.element.circle_progress(); 40 SALA.element.timeline(); 41 SALA.element.elasticstack(); 42 SALA.element.infinite(); 43 SALA.element.countdown(); 44 }, 45 46 windowLoad: function() { 47 // Begin Isotope 48 $(".isotope").each(function () { 49 let _this = $(this); 50 let grid = _this.find(".grid"); 51 let $grid = grid.isotope({ 52 itemSelector: ".element-item", 53 percentPosition: true, 54 columnWidth: ".grid-sizer", 55 }); 56 }); 57 // End Isotope 58 59 // Begin Popup Video 60 $(".popup-wrapper").each(function () { 61 $(this).on("click touchstart", ".icon-popup", function (e) { 62 e.preventDefault(); 63 let popup = $(this).closest(".icon-popup").data("popup"); 64 let iframe = $("#popup-wrap." + popup).find("iframe"); 65 let autoplayoff = iframe 66 .attr("src") 67 .replace("&autoplay=0", "&autoplay=1"); 68 $("#popup-wrap." + popup).addClass("is-active"); 69 iframe.attr("src", autoplayoff); 70 }); 71 72 $(".popup-wrap").on( 73 "click touchstart", 74 ".overlay, .close", 75 function (e) { 76 e.preventDefault(); 77 let iframe = $(this).closest(".popup-wrap").find("iframe"); 78 let autoplayoff = iframe 79 .attr("src") 80 .replace("&autoplay=1", "&autoplay=0"); 81 $(this).closest(".popup-wrap").removeClass("is-active"); 82 iframe.attr("src", iframe.attr("src")); 83 iframe.attr("src", autoplayoff); 84 } 85 ); 86 }); 87 // End Popup Video 88 89 // Begin Waypoints 90 let $elem = $(".offset-item"); 91 if( $elem.length > 0 ){ 92 let waypoints = $elem.waypoint( 93 function (direction) { 94 // Fix for different ver of waypoints plugin. 95 let _self = this.element ? this.element : this; 96 let $self = $(_self); 97 $self.addClass("animate"); 98 }, 99 { 100 offset: "92%", 101 triggerOnce: true, 102 } 103 ); 104 } 105 // End Waypoints 106 }, 107 108 windowScroll: function() {}, 109 110 swiper: function() { 111 $(".uxp-swiper-slider").each(function () { 112 let data = $(this); 113 let pagination = $(this).attr("data-pagination"); 114 let pagination_style = $(this).attr("data-pagination-style"); 115 let navigation_prev = data.find( '.swiper-button-prev' )[0]; 116 let navigation_next = data.find( '.swiper-button-next' )[0]; 117 let direction = data.attr("data-direction"); 118 let slide_center = ''; 119 let slide_loop = ''; 120 let nav_center = ''; 121 let gap_xl = parseInt(data.attr("data-gap-xl")); 122 let gap_md = parseInt(data.attr("data-gap-md")); 123 let xl = parseInt(data.attr("data-xl")); 124 let lg = parseInt(data.attr("data-lg")); 125 let md = parseInt(data.attr("data-md")); 126 let sm = parseInt(data.attr("data-sm"));
127 let es = parseInt(data.attr("data-es")); 128 let pre_view = 1; 129 if (es) { 130 pre_view = es; 131 } 132 133 if( data.attr("data-slider-center") === 'true' ){ 134 slide_center = true; 135 } else { 136 slide_center = false; 137 } 138 139 if( data.attr("data-slider-loop") === 'true' ){ 140 slide_loop = true; 141 } else { 142 slide_loop = false; 143 } 144 145 if( data.attr("data-nav-center") === 'true' ){ 146 nav_center = true; 147 } else { 148 nav_center = false; 149 } 150 151 var swiperOptions = { 152 slidesPerView: pre_view, 153 direction: direction, 154 allowTouchMove: true, 155 loop: slide_loop, 156 centeredSlides: slide_center, 157 pagination: { 158 el: "." + pagination, 159 clickable: true, 160 }, 161 navigation: { 162 nextEl: navigation_next, 163 prevEl: navigation_prev, 164 }, 165 breakpoints: { 166 0: { 167 slidesPerView: pre_view, 168 spaceBetween: gap_md, 169 }, 170 575: { 171 slidesPerView: sm, 172 spaceBetween: gap_md, 173 }, 174 768: { 175 slidesPerView: md, 176 spaceBetween: gap_xl, 177 }, 178 992: { 179 slidesPerView: lg, 180 spaceBetween: gap_xl, 181 }, 182 1200: { 183 slidesPerView: xl, 184 spaceBetween: gap_xl, 185 }, 186 } 187 }; 188 189 if ( pagination_style === 'fraction' ) { 190 swiperOptions.pagination.type = 'fraction'; 191 swiperOptions.pagination.renderCustom = function( swiper, current, total ) { 192 // Convert to string. 193 var currentStr = current.toString(); 194 var totalStr = total.toString(); 195 196 // Add leading 0. 197 currentStr = currentStr.padStart( 2, '0' ); 198 totalStr = totalStr.padStart( 2, '0' ); 199 200 return '<div class="fraction"><div class="current">' + currentStr + '</div><div class="separator"></div><div class="total">' + totalStr + '</div></div>'; 201 }; 202 } else { 203 swiperOptions.pagination.renderBullet = function (index, className) { 204 swiperOptions.pagination.type = 'bullets'; 205 return '<span class="' + className + '"></span>'; 206 }; 207 } 208 209 let swiper = new Swiper(this, swiperOptions); 210 211 if( nav_center === true ){ 212 var window_w = $(window).width(); 213 var item_w = $(this).find('.swiper-slide').width(); 214 var button_w = $(this).find('.swiper-button-next').width(); 215 var item_margin = parseInt($(this).find('.swiper-slide').css('margin-right')); 216 var size = (((window_w - item_w) / 2) - (item_margin / 2)) - (button_w / 2); 217 $(this).find('.swiper-button-prev').css( 'left', size + 'px' ); 218 $(this).find('.swiper-button-next').css( 'right', size + 'px' ); 219 } 220 221 }); 222 $(".thumbs-gallery").each(function () { 223 let control_data = $(this).find( '.control-swiper-slider' ); 224 let control_navigation_prev = control_data.find( '.swiper-button-prev' )[0]; 225 let control_navigation_next = control_data.find( '.swiper-button-next' )[0]; 226 let control_pagination = $(this).attr("data-pagination"); 227 let control_direction = control_data.attr("data-direction"); 228 let control_slide_center = ''; 229 let control_slide_loop = ''; 230 let control_gap_xl = parseInt(control_data.attr("data-gap-xl")); 231 let control_gap_md = parseInt(control_data.attr("data-gap-md")); 232 let control_xl = parseInt(control_data.attr("data-xl")); 233 let control_lg = parseInt(control_data.attr("data-lg")); 234 let control_md = parseInt(control_data.attr("data-md")); 235 let control_sm = parseInt(control_data.attr("data-sm")); 236 let control_es = parseInt(control_data.attr("data-e
236s")); 237 let control_pre_view = 1; 238 if (control_es) { 239 control_pre_view = control_es; 240 } 241 242 if( control_data.attr("data-slider-center") === 'true' ){ 243 control_slide_center = true; 244 } else { 245 control_slide_center = false; 246 } 247 248 if( control_data.attr("data-slider-loop") === 'true' ){ 249 control_slide_loop = true; 250 } else { 251 control_slide_loop = false; 252 } 253 254 let control_swiper = new Swiper(control_data[0], { 255 slidesPerView: control_pre_view, 256 direction: control_direction, 257 allowTouchMove: true, 258 loop: control_slide_loop, 259 centeredSlides: control_slide_center, 260 watchSlidesProgress: true, 261 pagination: { 262 el: "." + control_pagination, 263 clickable: true, 264 renderBullet: function (index, className) { 265 return '<span class="' + className + '"></span>'; 266 }, 267 }, 268 navigation: { 269 nextEl: control_navigation_prev, 270 prevEl: control_navigation_next, 271 }, 272 breakpoints: { 273 0: { 274 slidesPerView: control_pre_view, 275 spaceBetween: control_gap_md, 276 }, 277 575: { 278 slidesPerView: control_sm, 279 spaceBetween: control_gap_md, 280 }, 281 768: { 282 slidesPerView: control_md, 283 spaceBetween: control_gap_xl, 284 }, 285 992: { 286 slidesPerView: control_lg, 287 spaceBetween: control_gap_xl, 288 }, 289 1200: { 290 slidesPerView: control_xl, 291 spaceBetween: control_gap_xl, 292 }, 293 }, 294 }); 295 296 let view_data = $(this).find('.view-swiper-slider'); 297 let view_navigation_prev = view_data.find( '.swiper-button-prev' )[0]; 298 let view_navigation_next = view_data.find( '.swiper-button-next' )[0]; 299 let view_pagination = $(this).attr("data-pagination"); 300 let view_direction = view_data.attr("data-direction"); 301 let view_effect = view_data.attr("data-effect"); 302 let view_slide_center = ''; 303 let view_slide_loop = ''; 304 let view_gap_xl = parseInt(view_data.attr("data-gap-xl")); 305 let view_gap_md = parseInt(view_data.attr("data-gap-md")); 306 let view_xl = parseInt(view_data.attr("data-xl")); 307 let view_lg = parseInt(view_data.attr("data-lg")); 308 let view_md = parseInt(view_data.attr("data-md")); 309 let view_sm = parseInt(view_data.attr("data-sm")); 310 let view_es = parseInt(view_data.attr("data-es")); 311 let view_pre_view = 1; 312 if (view_es) { 313 view_pre_view = view_es; 314 } 315 316 if( view_data.attr("data-slider-center") === 'true' ){ 317 view_slide_center = true; 318 } else { 319 view_slide_center = false; 320 } 321 322 if( view_data.attr("data-slider-loop") === 'true' ){ 323 view_slide_loop = true; 324 } else { 325 view_slide_loop = false; 326 } 327 328 var setting = { 329 slidesPerView: view_pre_view, 330 direction: view_direction, 331 allowTouchMove: true, 332 loop: view_slide_loop, 333 centeredSlides: view_slide_center, 334 pagination: { 335 el: "." + view_pagination, 336 clickable: true, 337 renderBullet: function (index, className) { 338 return '<span class="' + className + '"></span>'; 339 }, 340 }, 341 thumbs: { 342 swiper: control_swiper, 343 }, 344 navigation: { 345 nextEl: view_navigation_next, 346 prevEl: view_navigation_prev, 347 }, 348 breakpoints: { 349 0: { 350 slidesPerView: view_pre_view, 351 spaceBetween: view_gap_md, 352 }, 353 575: { 354 slidesPerView: view_sm, 355 spaceBetween: view_gap_md, 356 }, 357 768: { 358 slidesPerView: view_md, 359 spaceBetween: view_gap_xl, 360 }, 361 992: { 362 slidesPerView: view_lg, 363 spaceBetween: view_gap_xl, 364 }, 365 1200: { 366 slidesPerView: view_xl, 367 spaceBetween: view_gap_xl, 368 }, 369 } 370 }; 371 372 if( view_effect ){ 373 setting.effect = view_effect; 374 } 375 376 let view_swiper = new Swiper(view_data[0], setting); 377 }); 378 }, 379 380 tabs: function() { 381 $(".tab-wrap").each(function () { 382 let nav = $(this).find(".tab-nav"); 383 let tab_content = $(this).find(".tab-content"); 384 $(this).on("click touchstart", ".tab-nav", function (e) { 385 e.preventDefault(); 386 let activeTab = $(this).attr("href"); 387 nav.not(this).removeClass("is-active"); 388 $(this).addClass("is-active"); 389 tab_content.removeClass("is-active"); 390 $(activeTab).addClass("is-active"); 391 }); 392 }); 393 }, 394 395 modern_tabs: function() { 396 $(".block-modern-tab").each(function () { 397 let nav = $(this).find(".tab-nav"); 398 let tab_content = $(this).find(".tab-content"); 399 $(this).on("click touchstart", ".tab-nav", function (e) { 400 e.preventDefault(); 401 let activeTab = $(this).attr("href"); 402 nav.not(this).removeClass("is-active"); 403 $(this).addClass("is-active"); 404 tab_content.removeClass("is-active"); 405 $(activeTab).addClass("is-active"); 406 }); 407 }); 408 }, 409 410 accordion: function() { 411 $( '.block-accordion.enable' ).each( function() { 412 if( $( this ).hasClass( 'active-first' ) ){ 413 $(".accordion-item").first().addClass( 'is-active' ); 414 $(".accordion-item").first().find( '.content' ).slideDown(); 415 } 416 $(".accordion-item").on( 'click', '.title', function (e) { 417 e.preventDefault(); 418 $(".accordion-item .title").not( this ).closest( '.accordion-item' ).removeClass( 'is-active' ); 419 $(".accordion-item .title").not( this ).next().slideUp(); 420 $( this ).closest( '.accordion-item' ).toggleClass( 'is-active' ); 421 $( this ).next().slideToggle(); 422 }); 423 }); 424 }, 425 426 scroll_top: function() { 427 $(".backtotop").each(function () { 428 let $scrollUp = $(this); 429 let lastScrollTop = 0; 430 $(window).on("scroll", function () { 431 let st = $(this).scrollTop(); 432 if (st > lastScrollTop) { 433 $scrollUp.removeClass("show"); 434 } else { 435 if ($(window).scrollTop() > 200) { 436 $scrollUp.addClass("show"); 437 } else { 438 $scrollUp.removeClass("show"); 439 } 440 } 441 lastScrollTop = st; 442 }); 443 444 $scrollUp.on("click", function (evt) { 445 $("html, body").animate({ scrollTop: 0 }, 600); 446 evt.preventDefault(); 447 }); 448 }); 449 }, 450 451 header: function() { 452 if( $( '.site-header' ).hasClass( 'is-sticky' ) ){ 453 let $scrollUp = $( '.site-header.is-sticky' ); 454 let lastScrollTop = 0; 455 $(window).on("scroll", function () { 456 let st = $(this).scrollTop(); 457 if (st > lastScrollTop) { 458 $scrollUp.removeClass("on-scroll"); 459 } else { 460 if ($(window).scrollTop() > 0) { 461 $scrollUp.addClass("on-scroll"); 462 } else { 463 $scrollUp.removeClass("on-scroll"); 464 } 465 } 466 lastScrollTop = st; 467 }); 468 } 469 }, 470 471 main_menu: function() { 472 473 // =============== Check Menu Outside =============== // 474 if( $(".is-normal-menu").length > 0 && $( window ).width() > 991 ){ 475 let normal_menu = $(".is-normal-menu"); 476 let sub_menu = normal_menu.find(".sub-menu"); 477 let outside = ''; 478 if( sub_menu.length > 0 ){ 479 for (let index = 0; index < sub_menu.length; index++) { 480 const element = sub_menu[index]; 481 let bounding = element.getBoundingClientRect(); 482 if (bounding.right > (window.innerWidth || document.documentElement.clientWidth)) { 483 outside = 'left'; 484 } 485 if (bounding.left < 0) { 486 outside = 'right'; 487 } 488 } 489 } 490 normal_menu.addClass(outside); 491 } 492 493 // =============== Check Has Submenu =============== // 494 if( $(".sub-menu").length > 0 ){ 495 $(".sub-menu").each( function() { 496 $( this ).closest( 'li' ).addClass( 'has-sub-menu' ); 497 $( this ).closest( '.mega-menu-item' ).addClass( 'has-sub-menu' ); 498 if( $( 'body' ).attr('dir') === 'rtl' ){ 499 $( this ).closest( 'li' ).find( '> a' ).prepend( '<span class="toggle-sub-menu"></span>' ); 500 } else { 501 $( this ).closest( 'li' ).find( '> a' ).append( '<span class="toggle-sub-menu"></span>' ); 502 } 503 }); 504 } 505 506 if( ($(".mega-menu-item").length > 0 && $( window ).width() <= 992) || $(".mega-menu-item").length > 0 && $( '.site-header' ).hasClass( 'layout-02' ) ){ 507 $(".mega-menu-item").each( function() { 508 if( $( this ).find( 'ul' ).length > 0 ){ 509 if( $( 'body' ).attr('dir') === 'rtl' ){ 510 $( this ).find( '.mega-head' ).prepend( '<span class="toggle-sub-menu"></span>' ); 511 } else { 512 $( this ).find( '.mega-head' ).append( '<span class="toggle-sub-menu"></span>' ); 513 } 514 } 515 }); 516 } 517 518 // =============== Canvas Menu =============== // 519 if( $( window ).width() <= 992 || $( '.site-header' ).hasClass( 'layout-02' ) ){ 520 let transform = 0, 521 index = 0; 522 $( '.toggle-sub-menu' ).on( 'click', function(e) { 523 e.preventDefault(); 524 e.stopPropagation(); 525 index++; 526 $( this ).closest( '.has-sub-menu' ).find( '> .sub-menu' ).addClass( 'open' ); 527 $( this ).closest( '.main-menu' ).find( '.menu-back' ).fadeIn(); 528 let main_menu = $( this ).closest( '.main-menu' ).find( '> ul' ); 529 if( main_menu.attr( 'data-transform' ) ){ 530 transform = main_menu.attr( 'data-transform' ); 531 transform = parseInt(transform) - 100; 532 } else { 533 transform = transform - 100; 534 } 535 main_menu.css( 'transform', 'translateX(' + transform + '%)' ); 536 main_menu.attr( 'data-transform', transform ); 537 }); 538 539 $( '.menu-back' ).on( 'click', function(e) { 540 e.preventDefault(); 541 if( $( this ).closest( '.main-menu' ).find( '.sub-menu' ).find( '.sub-menu' ).hasClass( 'open' ) ){ 542 $( this ).closest( '.main-menu' ).find( '.sub-menu' ).find( '.sub-menu' ).removeClass( 'open' ); 543 } else if( $( this ).closest( '.main-menu' ).find( '.sub-menu' ).hasClass( 'open' ) ){ 544 $( this ).closest( '.main-menu' ).find( '.sub-menu' ).removeClass( 'open' ); 545 } 546 let main_menu = $( this ).closest( '.main-menu' ).find( '> ul' ); 547 let transform = main_menu.attr( 'data-transform' ); 548 transform = parseInt(transform) + 100; 549 main_menu.css( 'transform', 'translateX(' + transform + '%)' ); 550 main_menu.attr( 'data-transform', transform ); 551 if( transform == 0 ){ 552 $( this ).fadeOut(); 553 } 554 }); 555 556 $( '.canvas-menu' ).on( 'click', '.icon', function(e) { 557 $( this ).closest( 'body' ).find( '.main-menu' ).addClass( 'is-active' ); 558 }); 559 560 $( '.menu-close' ).on( 'click', function(e) { 561 $( this ).closest( '.main-menu' ).removeClass( 'is-active' ); 562 }); 563 } 564 }, 565 566 dark_light_switcher: function() { 567 $( '.dl-switcher' ).on( 'click', function(e) { 568 e.preventDefault(); 569 var _this = $( this ), 570 body = $( 'body' ), 571 toddler = _this.find( '.toddler' ); 572 573 if( _this.hasClass( 'sala-dark-scheme' ) ){ 574 var text = $( this ).find( '.light' ).attr( 'data-text' ); 575 toddler.text(text); 576 } else { 577 var text = $( this ).find( '.dark' ).attr( 'data-text' ); 578 toddler.text(text); 579 } 580 581 _this.toggleClass( 'sala-dark-scheme' ); 582 body.toggleClass( 'sala-dark-scheme' ); 583 }); 584 }, 585 586 portfolio_isotope: function() { 587 $(".portfolio-isotope").each(function () { 588 var _this = $(this), 589 grid = _this.find(".grid"), 590 button = _this.find("button"), 591 filterValue = '', 592 layoutMode = ''; 593 594 if( grid.hasClass( 'masonry' ) ){ 595 layoutMode = 'masonry'; 596 } else { 597 layoutMode = 'fitRows'; 598 } 599 600 grid.imagesLoaded( function() { 601 var $grid = grid.isotope({ 602 itemSelector: ".portfolio-item", 603
603 percentPosition: true, 604 gutter: 0, 605 layoutMode: layoutMode, 606 masonry: { 607 columnWidth: ".grid-sizer", 608 }, 609 }); 610 611 var i = 1; 612 613 button.on("click", function () { 614 var currentValue = $( 'button.is-active' ).attr("data-filter"); 615 filterValue = $(this).attr("data-filter"); 616 button.not(this).removeClass("is-active"); 617 $(this).addClass("is-active"); 618 $grid.isotope({ filter: filterValue }); 619 if( grid.hasClass( 'metro' ) || grid.hasClass( 'mosaic' ) ){ 620 if( currentValue != filterValue ){ 621 i = 1; 622 } 623 if( i == 1 ){ 624 setTimeout( function() { 625 $( 'button.is-active' ).click(); 626 }, 1000); 627 } 628 i++; 629 } 630 }); 631 632 if( grid.hasClass( 'metro' ) ){ 633 $grid.on( 'arrangeComplete', function() { 634 $( '.portfolio-item' ).removeAttr( 'data-index' ); 635 $( '.portfolio-item' ).removeClass( 'is-active' ); 636 $( '.portfolio-item:not([style*="display: none"])' ).each( function(index) { 637 if( $( this ).is(":visible") ){ 638 $( this ).attr( 'data-index', index + 1 ); 639 $( this ).addClass( 'is-active' ); 640 } 641 }); 642 }); 643 } 644 645 setTimeout( function() { 646 if( $(window).width() > 767 && grid.hasClass( 'mosaic' ) ){ 647 $( '.portfolio-item:nth-child(4n+2)' ).each( function() { 648 var _this = $( this ), 649 cur_height = 0, 650 height = 0, 651 marginTop = 0; 652 653 cur_height = _this.height(); 654 height = _this.next().height(); 655 656 if( height > cur_height ){ 657 marginTop = (height - cur_height) / 2; 658 _this.css( 'margin-top', marginTop + 'px' ); 659 } else if( cur_height > height ){ 660 marginTop = (cur_height - height) / 2; 661 _this.next().css( 'margin-top', marginTop + 'px' ); 662 } 663 }); 664 $( '.portfolio-item:nth-child(4n+1)' ).each( function() { 665 var _this = $( this ), 666 cur_height = 0, 667 height = 0, 668 marginTop = 0; 669 670 cur_height = _this.height(); 671 height = _this.prev().height(); 672 673 if( height > cur_height ){ 674 marginTop = (height - cur_height) / 2; 675 _this.css( 'margin-top', marginTop + 'px' ); 676 } else if( cur_height > height ){ 677 marginTop = (cur_height - height) / 2; 678 _this.prev().css( 'margin-top', marginTop + 'px' ); 679 } 680 }); 681 $grid.on( 'arrangeComplete', function(event, filteredItems) { 682 $( '.portfolio-item' ).removeAttr( 'data-index' ); 683 $( '.portfolio-item' ).removeClass( 'is-active' ); 684 $( '.portfolio-item' ).removeClass('nextodd'); 685 $( '.portfolio-item' ).removeClass('preveven'); 686 $( '.portfolio-item' ).css( 'margin-top', '0px' ); 687 var j = 0; 688 $( '.portfolio-item:not([style*="display: none"])' ).each( function(index) { 689 if( $( this ).is(":visible") ){ 690 j++; 691 if (j % 4 === 1) { 692 $( this ).attr( 'data-index', 'odd' ); 693 } 694 if (j % 4 === 0) { 695 $( this ).attr( 'data-index', 'even' ); 696 } 697 $( this ).addClass( 'is-active' ); 698 } 699 }); 700 $( '.portfolio-item[data-index="odd"]' ).each( function() { 701 var _this = $( this ), 702 cur_height = 0, 703 height = 0, 704 marginTop = 0, 705 nextodd = ''; 706 707 cur_height = _this.height(); 708 709 nextodd = _this.nextAll( '.portfolio-item.is-active' ).first().addClass('nextodd'); 710 height = nextodd.height(); 711 712 if( height > cur_height ){ 713 marginTop = (height - cur_height) / 2; 714 _this.css( 'margin-top', marginTop + 'px' ); 715 _this.nextAll( '.portfolio-item.is-active' ).first().css( 'margin-top', '0px' ); 716 } else if( cur_height > height ){ 717 marginTop = (cur_height - height) / 2; 718 _this.css( 'margin-top', '0px' ); 719 _this.nextAll( '.portfolio-item.is-active' ).first().css( 'margin-top', marginTop + 'px' ); 720 } 721 }); 722 $( '.portfolio-item[data-index="even"]' ).each( function() { 723 var _this = $( this ), 724 cur_height = 0, 725 height = 0, 726 marginTop = 0, 727 preveven = ''; 728 729 cur_height = _this.height(); 730 preveven = _this.prevAll( '.portfolio-item.is-active' ).first().addClass('preveven'); 731 height = preveven.height(); 732 733 if( height > cur_height ){ 734 marginTop = (height - cur_height) / 2; 735 _this.css( 'margin-top', marginTop + 'px' ); 736 _this.prevAll( '.portfolio-item.is-active' ).first().css( 'margin-top', '0px' ); 737 } else if( cur_height > height ){ 738 marginTop = (cur_height - height) / 2; 739 _this.css( 'margin-top', '0px' ); 740 _this.prevAll( '.portfolio-item.is-active' ).first().css( 'margin-top', marginTop + 'px' ); 741 } 742 }); 743 }); 744 } 745 }, 500); 746 }); 747 }); 748 }, 749 750 nice_select: function() { 751 if(typeof $('select').niceSelect === "function"){ 752 $('select').niceSelect(); 753 } 754 }, 755 756 nouislider: function() { 757 if(typeof noUiSlider != 'undefined'){ 758 var range_price = $( '#range-price' )[0]; 759 var input_price_min = $( 'input[name="price_min"]' ); 760 var input_price_max = $( 'input[name="price_max"]' ); 761 var price_min = $( '.price-min span' ); 762 var price_max = $( '.price-max span' ); 763 noUiSlider.create(range_price, { 764 start: [10, 130], 765 connect: true, 766 range: { 767 'min': 10, 768 'max': 200 769 } 770 }); 771 range_price.noUiSlider.on('update', function (values, handle) { 772 price_min.text(values[0]); 773 price_max.text(values[1]); 774 input_price_min.val(values[0]); 775 input_price_max.val(values[1]); 776 }); 777 } 778 }, 779 780 zoom_image: function() { 781 if(typeof $('.zoom').zoom === "function"){ 782 $('.zoom').zoom(); 783 } 784 }, 785 786 input_number: function() { 787 $( '.quantity' ).each( function() { 788 var spinner = $(this), 789 input = spinner.find('input[type="number"]'), 790 btnUp = spinner.find('.quantity-up'), 791 btnDown = spinner.find('.quantity-down'), 792 min = input.attr('min'), 793 max = input.attr('max'); 794 795 btnUp.on( 'click', function() { 796 var oldValue = parseFloat(input.val()); 797 if (oldValue >= max) { 798 var newVal = oldValue; 799 } else { 800 var newVal = oldValue + 1; 801 } 802 spinner.find("input").val(newVal); 803 spinner.find("input").trigger("change"); 804 }); 805 806 btnDown.on( 'click', function() { 807 var oldValue = parseFloat(input.val()); 808 if (oldValue <= min) { 809 var newVal = oldValue; 810 } else { 811 var newVal = oldValue - 1; 812 } 813 spinner.find("input").val(newVal); 814 spinner.find("input").trigger("change"); 815 }); 816 }); 817 }, 818 819 reviews: function() { 820 $( '.stars a' ).on( 'click', function(e) { 821 e.preventDefault(); 822 $( this ).closest( '.stars' ).addClass( 'is-active' ); 823 $( '.stars a' ).not( this ).removeClass( 'is-active' ); 824 $( this ).addClass( 'is-active' ); 825 $( 'input[name="rating"]' ).val( $( '.stars a' ).index(this) + 1 ); 826 }); 827 }, 828 829 checkout: function() { 830 $( '.show-form-coupon' ).on( 'click', function(e) { 831 e.preventDefault(); 832 $( '.checkout-coupon' ).slideToggle(); 833 }); 834 }, 835 836 section_pricing: function() { 837 $( '.section-pricing' ).each( function() { 838 $( this ).on( 'click', '.switch', function(e) { 839 e.preventDefault(); 840 $( this ).toggleClass( 'is-active' ); 841 $( '.pricing-table' ).each( function() { 842 if( $( this ).hasClass( 'is-active' ) ){ 843 $( this ).removeClass( 'is-active' ); 844 } else { 845 $( this ).addClass( 'is-active' ); 846 } 847 }); 848 }); 849 }); 850 }, 851 852 section_table: function() { 853 var i = 0; 854 $( '.section-table table tbody tr' ).each( function() { 855 if( $( this ).find( 'td.colspan-full' ).length > 0 ){ 856 i = 0; 857 } else { 858 i++; 859 if (i % 2 === 0) { 860 $( this ).addClass( 'even' ); 861 } else { 862 $( this ).addClass( 'odd' ); 863 } 864 } 865 }); 866 }, 867 868 section_counter: function() { 869 $( '.counter' ).each( function() { 870 $( this ).counterUp({ 871 delay: 10, 872 time: 1000 873 }); 874 }); 875 }, 876 877 form: function() { 878 $( '.field-password' ).each( function() { 879 $( this ).on( 'click', '.view-password', function() { 880 var input = $( this ).closest( '.field-password' ).find( 'input' ); 881 if (input.attr('type') === 'text') { 882 input.attr('type', 'password'); 883 } else { 884 input.attr('type', 'text'); 885 } 886 }); 887 }); 888 }, 889 890 row: function() { 891 $( '.row-full' ).each( function() { 892 var window_w = $( window ).width(); 893 var _this = $( this ); 894 if( window_w > 992 ){ 895 var container_w = 0; 896 var col_left = $( this ).find('.col-full-left'); 897 var col_right = $( this ).find('.col-full-right'); 898 var padding_right = col_right.css( 'padding-right' ); 899 900 if( $( this ).closest( '.container' ) ){
901 container_w = $( this ).closest( '.container' ).width(); 902 } else if( $( this ).closest( '.container-fluid' ) ){ 903 container_w = $( this ).closest( '.container-fluid' ).width(); 904 } 905 906 var size = (window_w - container_w) / 2; 907 908 if( col_left.length > 0 ){ 909 col_left.css( 'margin-left', (size * -1) + 'px' ); 910 var size_left = col_left.outerWidth() + size; 911 col_left.css( 'width', 'calc(' + size_left + 'px )' ); 912 col_left.css( 'max-width', 'calc(' + size_left + 'px )' ); 913 } 914 915 if( col_right.length > 0 ){ 916 var size_right = col_right.outerWidth() + size; 917 col_right.css( 'width', 'calc(' + size_right + 'px )' ); 918 col_right.css( 'max-width', 'calc(' + size_right + 'px )' ); 919 } 920 } 921 }); 922 }, 923 924 circle_progress: function() { 925 $( '.circle-progress' ).each( function() { 926 $( this ).circleProgress({ 927 startAngle: - Math.PI / 4 * 2, 928 }); 929 }); 930 }, 931 932 timeline: function() { 933 $( '.block-timeline.layout-02' ).each( function() { 934 var _this = $( this ); 935 var _item = _this.find( '.item' ); 936 var _date = _this.find( '.date-line' ); 937 var _date_click = _this.find( '.date-line a' ); 938 _date.on( 'click', 'a', function(e) { 939 e.preventDefault(); 940 var id = $(this).index(); 941 _item.removeClass( 'is-active' ); 942 _item.eq(id).addClass( 'is-active' ); 943 _date_click.not( this ).removeClass( 'is-active' ); 944 $( this ).addClass( 'is-active' ); 945 }); 946 }); 947 }, 948 949 elasticstack: function() { 950 $( '.block-elasticstack' ).each( function() { 951 var dragback = $( this ).attr( 'data-dragback' ); 952 var dragmax = $( this ).attr( 'data-dragmax' ); 953 var item = $( this ).find( '.item' ); 954 var elasticstack = $( this ).find( '.elasticstack' )[0]; 955 956 var maxHeight = Math.max.apply(null, item.map(function () { 957 return $(this).height(); 958 }).get()); 959 960 item.css( 'height', maxHeight + 'px' ); 961 962 var elasticstackheight = maxHeight + 100; 963 964 $( this ).find( '.elasticstack' ).css( 'height', elasticstackheight + 'px' ); 965 966 new ElastiStack( elasticstack, { 967 // distDragBack: if the user stops dragging the image in a area that does not exceed [distDragBack]px 968 // for either x or y then the image goes back to the stack 969 distDragBack : dragback, 970 // distDragMax: if the user drags the image in a area that exceeds [distDragMax]px 971 // for either x or y then the image moves away from the stack 972 distDragMax : dragmax, 973 // callback 974 onUpdateStack : function( current ) { return false; } 975 } ); 976 }); 977 }, 978 979 infinite: function() { 980 $.fn.ux_multiply = function (numCopies) { 981 var newElements = this.clone(); 982 for (var i = 1; i < numCopies; i++) { 983 newElements = newElements.add(this.clone()); 984 } 985 return newElements; 986 }; 987 $(".block-infinite .infinite").each(function () { 988 var listWidth = 0; 989 990 var item = $(this).find(".item"); 991 992 if (item.length > 0) { 993 item.each(function () { 994 listWidth += $(this).innerWidth(); 995 }); 996 997 var mult = $(this).innerWidth() / listWidth; 998 999 if( $(this).hasClass( 'layout-02' ) ){ 1000 1001 $(this).prepend('<div class="item-dup"></div>'); 1002 1003 if (mult > 0.5) { 1004 $(this)
1005 .find(".item-dup") 1006 .prepend(item.ux_multiply(Math.ceil(mult))); 1007 } else { 1008 $(this).find(".item-dup").prepend(item.ux_multiply(1)); 1009 } 1010 } else { 1011 $(this).append('<div class="item-dup"></div>'); 1012 1013 if (mult > 0.5) { 1014 $(this) 1015 .find(".item-dup") 1016 .append(item.ux_multiply(Math.ceil(mult))); 1017 } else { 1018 $(this).find(".item-dup").append(item.ux_multiply(1)); 1019 } 1020 } 1021 1022 $(this).css("width", listWidth); 1023 1024 var itemcount = $(this).find(".item").length; 1025 var itemsize = listWidth / itemcount; 1026 1027 var speed = $(this).data("speed"); 1028 var duration = itemsize * 10; 1029 1030 if (speed === 200) { 1031 duration = 10; 1032 } else if (speed == 0) { 1033 duration = 0; 1034 } else if (speed > 100) { 1035 speed = speed - 100; 1036 speed = (speed / 10) * itemsize; 1037 duration = duration - speed; 1038 } else if (speed < 100) { 1039 speed = 100 - speed; 1040 speed = (speed / 10) * (itemsize * 8); 1041 duration = duration + speed; 1042 } 1043 1044 var speed = (itemcount * duration) / 1000; 1045 $(this).css("animation-duration", speed + "s"); 1046 } 1047 }); 1048 }, 1049 1050 countdown: function() { 1051 function addzeros(number) { 1052 if( isNaN(number) ){ 1053 return number; 1054 } 1055 if (number < 10) { 1056 number = '0' + number; 1057 } 1058 return number; 1059 } 1060 $( '.block-countdown' ).each( function() { 1061 var time = $( this ).attr( 'data-time' ); 1062 var expired_text = $( this ).attr( 'data-expired-text' ); 1063 var e_days = $( this ).find( '.days .number' ); 1064 var e_hours = $( this ).find( '.hours .number' ); 1065 var e_minutes = $( this ).find( '.minutes .number' ); 1066 var e_seconds = $( this ).find( '.seconds .number' ); 1067 var countDownDate = new Date(time).getTime(); 1068 1069 // Update the count down every 1 second 1070 var x = setInterval(function() { 1071 1072 // Get today's date and time 1073 var now = new Date().getTime(); 1074 1075 // Find the distance between now and the count down date 1076 var distance = countDownDate - now; 1077 1078 // Time calculations for days, hours, minutes and seconds 1079 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 1080 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 1081 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 1082 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 1083 1084 // Display the result in the element 1085 e_days.text(addzeros(days)); 1086 e_hours.text(addzeros(hours)); 1087 e_minutes.text(addzeros(minutes)); 1088 e_seconds.text(addzeros(seconds)); 1089 1090 // If the count down is finished, write some text 1091 if (distance < 0) { 1092 clearInterval(x); 1093 $( '.block-countdown > *' ).remove(); 1094 $( '.block-countdown' ).text(expired_text); 1095 } 1096 }, 1000); 1097 }); 1098 } 1099 } 1100 1101 SALA.onReady = { 1102 init: function() { 1103 SALA.element.init(); 1104 } 1105 }; 1106 1107 SALA.onLoad = { 1108 init: function() { 1109 SALA.element.windowLoad(); 1110 $('.preload').remove(); 1111 $( '.twentytwenty-wrap' ).each( function() { 1112 $(this).find('.twentytwenty-container').css( 'height', '386px' ); 1113 $(this).twentytwenty(); 1114 }); 1115 } 1116 }; 1117 1118 SALA.onScroll = { 1119 init: function() { 1120 SALA.element.windowScroll(); 1121 } 1122 }; 1123 1124 $( document ).on('ready', SALA.onReady.init ); 1125 $( window ).on('scroll', SALA.onScroll.init ); 1126 $( window ).on('load', SALA.onLoad.init ); 1127})(jQuery); 1128 1129if( typeof WOW == 'function' ){ 1130 var wow = new WOW( 1131 { 1132 boxClass: 'wow', // animated element css class (default is wow) 1133 animateClass: 'animate__animated', // animation css class (default is animated) 1134 offset: 0, // distance to the element when triggering the animation (default is 0) 1135 mobile: true, // trigger animations on mobile devices (default is true) 1136 live: true, // act on asynchronously loaded content (default is true) 1137 callback: function(box) { 1138 // the callback is fired every time an animation is started 1139 // the argument that is passed in is the DOM node being animated 1140 }, 1141 scrollContainer: null, // optional scroll container selector, otherwise use window, 1142 resetAnimation: true, // reset animation on end (default is true) 1143 } 1144 ); 1145 wow.init(); 1146}
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.