1/** 2 * Corsa plugins initialization and main theme JavaScript code 3 * 4 * @requires jQuery 5 */ 6jQuery(document).ready(function(){ 7 "use strict"; 8 9 // The commonly used DOM elements 10 var $window = jQuery(window), 11 $html = jQuery('html'), 12 $body = jQuery('.l-body'), 13 $canvas = jQuery('.l-canvas'), 14 $header = jQuery('.l-header'), 15 $logoImg = jQuery('.w-logo-img'), 16 $headerNav = jQuery('.l-header .w-nav'), 17 $firstSection = jQuery('.l-section').first(), 18 $firstSubsectionH = $firstSection.find('.l-subsection-h').first(), 19 $supersized = jQuery('.us_supersized'), 20 $main = jQuery('.l-main'), 21 $footer = jQuery('.l-footer'), 22 $topLink = jQuery('.w-toplink'), 23 resizeTimer = null, 24 videoInit = false, 25 scrollInit = false; 26 27 if (jQuery.magnificPopup){ 28 jQuery('a[ref=magnificPopup][class!=direct-link]').magnificPopup({ 29 type: 'image', 30 fixedContentPos: false 31 }); 32 } 33 34 if (jQuery().waypoint){ 35 36 jQuery('.animate_fade, .animate_afc, .animate_afl, .animate_afr, .animate_aft, .animate_afb, .animate_wfc, ' + 37 '.animate_hfc, .animate_rfc, .animate_rfl, .animate_rfr').waypoint(function(){ 38 if ( ! jQuery(this).hasClass('animate_start')){ 39 var elm = jQuery(this); 40 setTimeout(function() { 41 elm.addClass('animate_start'); 42 }, 20); 43 } 44 }, {offset:'85%', triggerOnce: true}); 45 46 jQuery('.w-counter').each(function(){ 47 var $this = jQuery(this), 48 counter = $this.find('.w-counter-number'), 49 count = parseInt($this.data('count') || 10), 50 prefix = $this.data('prefix') || '', 51 suffix = $this.data('suffix') || '', 52 number = parseInt($this.data('number') || 0); 53 54 counter.html(prefix+number+suffix); 55 56 $this.waypoint(function(){ 57 var step = Math.ceil((count-number)/25), 58 stepCount = Math.floor((count-number) / step), 59 handler = setInterval(function(){ 60 number += step; 61 stepCount--; 62 counter.html(prefix+number+suffix); 63 if (stepCount <= 0) { 64 counter.html(prefix+count+suffix); 65 window.clearInterval(handler); 66 } 67 }, 40); 68 }, {offset:'85%', triggerOnce: true}); 69 }); 70 } 71 72 var headerDisableStickyHeaderWidth = parseInt(window.headerDisableStickyHeaderWidth || 0), 73 mobileNavWidth = parseInt(window.mobileNavWidth || 1000), 74 defaultLogoHeight = parseInt(window.defaultLogoHeight || 50), 75 mobileLogoHeight = parseInt(window.mobileLogoHeight || 30), 76 77 // Body modificators 78 headerType = $body.mod('headertype'), 79 homeType = $body.mod('hometype'), 80 headerPos = $body.mod('headerpos'), 81 82 // Window dimensions 83 winHeight = parseInt($window.height()), 84 winWidth = parseInt($window.width()), 85 headerHeight = $header.outerHeight(), 86 footerHeight = $footer.outerHeight(), 87 headerTop = 0, 88 scrollOffsetTolerance = 0; 89 90 // Removing fullscreen subsections from the home section (in case someone adds them) 91 $firstSection.find('.l-subsection.full_screen').removeClass('full_screen').removeClass('valign_center'); 92 93 var fullscreenSubsections = jQuery('.l-subsection.full_screen'); 94 95 var handleScroll = function(){ 96 var scrollTop = parseInt($window.scrollTop(), 10); 97 98 $topLink.toggleClass('active', (scrollTop >= winHeight)); 99 100 if (headerType == 'sticky' && (headerPos == 'bottom' || headerPos == 'outside')){ 101 $header.toggleClass('fixed', (scrollTop > headerTop)); 102 $header.css('top', (scrollTop > headerTop)?0:headerTop); 103 } 104 105 // Move trough each menu and check its position with scroll position then add current class 106 // TODO Rewrite this block 107 jQuery('.w-nav-item a[href^="#"]').each(function(){ 108 var thisHref = jQuery(this).attr('href'); 109 110 if (jQuery(thisHref).length){ 111 var thisTruePosition = parseInt(jQuery(thisHref).offset().top, 10), 112 thisPosition = thisTruePosition - headerHeight; 113 114 if (scrollTop >= thisPosition){ 115 jQuery('.w-nav-item a').parent().removeClass('active'); 116 jQuery('.w-nav-item a[href="'+ thisHref +'"]').parent().addClass('active'); 117 if (jQuery('.w-nav-item a[href="'+ thisHref +'"]').parent().parent().parent().hasClass('w-nav-item')) { 118 jQuery('.w-nav-item a[href="'+ thisHref +'"]').parent().parent().parent().addClass('active'); 119 } 120 121 jQuery('.w-cart').each(function(){ 122 if (jQuery(this).hasClass('status_empty')){ 123 jQuery(this).css('display', ''); 124 } 125 });
126 jQuery(thisHref).find('.w-cart').css('display', 'block'); 127 } 128 } 129 }); 130 //If we're at the bottom of the page, move pointer to the last section 131 var bottomPage = parseInt(jQuery(document).height(), 10) - parseInt(jQuery(window).height(), 10); 132 133 if(scrollTop === bottomPage || scrollTop >= bottomPage){ 134 var thisHref = jQuery('.w-nav-item a[href^="#"]:last').attr('href'); 135 if (jQuery(thisHref).length) { 136 jQuery('.w-nav-item a').parent().removeClass('active'); 137 jQuery('.w-nav-item a[href^="#"]:last').parent().addClass('active'); 138 if (jQuery('.w-nav-item a[href^="#"]:last').parent().parent().parent().hasClass('w-nav-item')) { 139 jQuery('.w-nav-item a[href^="#"]:last').parent().parent().parent().addClass('active'); 140 } 141 } 142 } 143 // TODO / Rewrite this block 144 }; 145 146 var renderMenu = function(){}, 147 setFixedMobileMaxHeight = function(){}; 148 if ($headerNav.length > 0){ 149 var touchMenuInited = $headerNav.hasClass('touch_enabled'), 150 touchMenuOpened = false, 151 navControl = $headerNav.find('.w-nav-control'), 152 navItems = $headerNav.find('.w-nav-item'), 153 navList = $headerNav.find('.w-nav-list.level_1'), 154 navSubItems = navList.find('.w-nav-item.has_sublevel'), 155 navSubAnchors = navList.find('.w-nav-item.has_sublevel > .w-nav-anchor'), 156 navSubLists = navList.find('.w-nav-item.has_sublevel > .w-nav-list'), 157 navAnchors = $headerNav.find('.w-nav-anchor'), 158 togglable = window.headerMenuTogglable || false; 159 // Count proper dimensions 160 setFixedMobileMaxHeight = function(){ 161 if (winWidth > headerDisableStickyHeaderWidth){ 162 var headerOuterHeight = $header.outerHeight(), 163 navListOuterHeight = Math.min(navList.outerHeight(), headerOuterHeight), 164 menuOffset = headerOuterHeight - navListOuterHeight; 165 navList.css('max-height', winHeight-menuOffset+'px'); 166 } 167 else{ 168 navList.css('max-height', 'auto'); 169 } 170 }; 171 if ( ! touchMenuInited){ 172 $headerNav.addClass('touch_disabled'); 173 navList.css('display', 'block'); 174 } 175 // Mobile menu toggler 176 navControl.on('click', function(){ 177 touchMenuOpened = ! touchMenuOpened; 178 if (touchMenuOpened){ 179 // Closing opened sublists 180 navItems.filter('.opened').removeClass('opened'); 181 navSubLists.css('height', 0); 182 183 navList.slideDownCSS(); 184 } 185 else{ 186 navList.slideUpCSS(); 187 } 188 if (headerType == 'sticky') setFixedMobileMaxHeight(); 189 }); 190 // Mobile submenu togglers 191 var toggleEvent = function(e){ 192 if ( ! touchMenuInited) return; 193 e.stopPropagation(); 194 e.preventDefault(); 195 var $item = jQuery(this).closest('.w-nav-item'), 196 $sublist = $item.children('.w-nav-list'); 197 if ($item.hasClass('opened')){ 198 $item.removeClass('opened'); 199 $sublist.slideUpCSS(); 200 } 201 else { 202 $item.addClass('opened'); 203 $sublist.slideDownCSS(); 204 } 205 }; 206 // Toggle on item clicks 207 if (togglable){ 208 navSubAnchors.on('click', toggleEvent); 209 } 210 // Toggle on arrows 211 else { 212 navList.find('.w-nav-item.has_sublevel > .w-nav-anchor > .w-nav-arrow').on('click', toggleEvent); 213 } 214 // Mark all the togglable items 215 navSubItems.each(function(){ 216 var $this = jQuery(this), 217 $parentItem = $this.parent().closest('.w-nav-item'); 218 if ($parentItem.length == 0 || $parentItem.mod('columns') === false) $this.addClass('togglable'); 219 }); 220 // Touch device handling in default (notouch) layout 221 if ( ! $html.hasClass('no-touch')){ 222 navList.find('.w-nav-item.has_sublevel.togglable > .w-nav-anchor').on('click', function(e){ 223 if (touchMenuInited) return; 224 e.preventDefault(); 225 var $this = jQuery(this), 226 $item = $this.parent(), 227 $list = $item.children('.w-nav-list'); 228 229 // Second tap: going to the URL 230 if ($item.hasClass('opened')) return location.assign($this.attr('href')); 231 232 $list.fadeInCSS(); 233 $item.addClass('opened'); 234 var outsideClickEvent = function(e){ 235 if (jQuery.contains($item[0], e.target)) return; 236 $item.removeClass('opened'); 237 $list.fadeOutCSS(); 238 $body.off('touchstart', outsideClickEvent); 239 }; 240 241 $body.on('touchstart', outsideClickEvent); 242 }); 243 } 244 // Desktop device hovers 245 else { 246 navSubItems 247 .filter('.togglable') 248 .on('mouseenter', function(){ 249 if (touchMenuInited) return; 250 var $list = jQuery(this).children('.w-nav-list'); 251 $list.fadeInCSS(); 252 }) 253 .on('mouseleave', function(){ 254 if (touchMenuInited) return; 255 var $list = jQuery(this).children('.w-nav-list'); 256 $list.fadeOutCSS(); 257 }); 258 } 259 // Close menu on anchor clicks 260 navAnchors.on('click', function(){ 261 if (winWidth > mobileNavWidth) return; 262 // Toggled the item 263 if (togglable && jQuery(this).closest('.w-nav-item').hasClass('has_sublevel')) return; 264 navList.slideUpCSS(); 265 touchMenuOpened = false; 266 }); 267 renderMenu = function(){ 268 // Mobile layout 269 if (winWidth <= mobileNavWidth){ 270 271 // Switching from desktop to mobile layout 272 if ( ! touchMenuInited){ 273 touchMenuInited = true; 274 touchMenuOpened = false; 275 navList.css('height', 0); 276 277 // Closing opened sublists 278 navItems.filter('.opened').removeClass('opened'); 279 navSubLists.css('height', 0); 280 281 $headerNav.removeClass('touch_disabled').addClass('touch_enabled'); 282 } 283 284 // Max-height limitation for fixed header layouts 285 if (headerType == 'sticky') setFixedMobileMaxHeight(); 286 } 287 288 // Switching from mobile to desktop layout 289 else if (touchMenuInited){ 290 $headerNav.removeClass('touch_enabled').addClass('touch_disabled'); 291 292 // Clearing height-hiders 293 navList.css({height: '', 'max-height': '', display: 'block', opacity: 1}); 294 295 // Closing opened sublists 296 navItems.filter('.opened').removeClass('opened'); 297 navSubLists.css('height', ''); 298 navItems.filter('.togglable').children('.w-nav-list').css('display', 'none'); 299 300 touchMenuInited = false; 301 touchMenuOpened = false; 302 } 303 304 }; 305 } 306 307 var updateVideosSizes = function(){ 308 jQuery('.video-background').each(function(){ 309 var container = jQuery(this); 310 if (winWidth <= 1024) return jQuery(this).hide(); 311 var mejsContainer = container.find('.mejs-container'), 312 poster = container.find('.mejs-mediaelement img'), 313 video = container.find('video'), 314 videoWidth = video.attr('width'), 315 videoHeight = video.attr('height'), 316 videoProportion = videoWidth / videoHeight, 317 parent = container.parent(), 318 parentWidth = parent.outerWidth(), 319 parentHeight = parent.outerHeight(), 320 proportion, 321 centerX, centerY; 322 if (mejsContainer.length == 0) return; 323 // Proper sizing 324 if (video.length > 0 && video[0].player && video[0].player.media) videoWidth = video[0].player.media.videoWidth; 325 if (video.length > 0 && video[0].player && video[0].player.media) videoHeight = video[0].player.media.videoHeight; 326 327 container.show(); 328 329 parent.find('span.mejs-offscreen').hide(); 330 331 proportion = (parentWidth/parentHeight > videoWidth/videoHeight)?parentWidth/videoWidth:parentHeight/videoHeight; 332
333 container.width(proportion*videoWidth); 334 container.height(proportion*videoHeight); 335 336 poster.width(proportion*videoWidth); 337 poster.height(proportion*videoHeight); 338 339 centerX = (parentWidth < videoWidth*proportion)?(parentWidth - videoWidth*proportion)/2:0; 340 centerY = (parentHeight < videoHeight*proportion)?(parentHeight - videoHeight*proportion)/2:0; 341 342 container.css({ 'left': centerX, 'top': centerY }); 343 344 mejsContainer.css({width: '100%', height: '100%'}); 345 video.css({'object-fit': 'cover'}); 346 }); 347 }; 348 349 var handleResize = function(){ 350 winHeight = parseInt($window.height()); 351 winWidth = parseInt($window.width()); 352 headerTop = 0; 353 scrollOffsetTolerance = 0; 354 355 // Resetting fullscreen sliders 356 $supersized.css('height', '0px'); 357 $firstSection.css('min-height', ''); 358 $firstSubsectionH.css('margin-top', ''); 359 360 var firstSectionHeight = parseInt($firstSection.height()); 361 362 headerHeight = $header.outerHeight(); 363 footerHeight = $footer.outerHeight(); 364 365 $main.css('margin-bottom', footerHeight+'px'); 366 367 if (headerPos == 'top'){ 368 if (homeType == 'fullscreen'){ 369 firstSectionHeight = Math.max((winHeight-headerHeight), firstSectionHeight); 370 $firstSection.css('min-height', firstSectionHeight+'px'); 371 } 372 if (headerType == 'sticky'){ 373 $firstSection.css('margin-top', headerHeight+'px'); 374 } 375 } 376 else if (headerPos == 'bottom'){ 377 if (homeType == 'fullscreen'){ 378 firstSectionHeight = Math.max((winHeight-headerHeight), firstSectionHeight); 379 $firstSection.css({ 380 'min-height': firstSectionHeight+'px', 381 'margin-bottom': headerHeight+'px' 382 }); 383 headerTop = firstSectionHeight; 384 } 385 else{ 386 $firstSection.css('margin-bottom', headerHeight+'px'); 387 headerTop = firstSectionHeight; 388 } 389 } 390 else if (headerPos == 'outside'){ 391 if (homeType == 'fullscreen'){ 392 firstSectionHeight = Math.max(winHeight, firstSectionHeight); 393 $firstSection.css({ 394 'min-height': firstSectionHeight+'px', 395 'margin-bottom': headerHeight+'px' 396 }); 397 headerTop = firstSectionHeight; 398 } 399 else { 400 $firstSection.css('margin-bottom', headerHeight+'px'); 401 headerTop = firstSectionHeight; 402 } 403 } 404 405 // Updating fullscreen secondary page sections 406 fullscreenSubsections.each(function(){ 407 var subsection = jQuery(this), 408 spaceHeight = ((headerType == 'sticky') ? (winHeight-headerHeight) : winHeight) + 1; 409 subsection.css('min-height', spaceHeight); 410 if (subsection.hasClass('valign_center')){ 411 var subsectionH = subsection.find('.l-subsection-h'), 412 contentHeight; 413 subsectionH.css('margin-top', ''); 414 contentHeight = subsectionH.outerHeight(); 415 var heightDifference = parseInt(subsection.height()) - contentHeight; 416 subsectionH.css('margin-top', (heightDifference > 0) ? (heightDifference/2) : ''); 417 } 418 }); 419 420 // Updating fullscreen sliders 421 $supersized.each(function(){ 422 var $this = jQuery(this), 423 $parentSection = $this.closest('.l-section'); 424 if ($parentSection.length) $this.css('height', $parentSection.height()); 425 }); 426 427 if (homeType == 'fullscreen'){ 428 var subsectionsHeight = 0, 429 firstSubsectionMargin; 430 $firstSection.find('.l-subsection-h').each(function(){ 431 subsectionsHeight += jQuery(this).height(); 432 }); 433 firstSubsectionMargin = Math.max((firstSectionHeight - subsectionsHeight)/2, 0); 434 $firstSubsectionH.css('margin-top', firstSubsectionMargin); 435 } 436 437 if (typeof(api) != 'undefined') { 438 api.resizeNow(); 439 } 440 441 $header.css('top', headerTop+'px'); 442 443 if (headerType == 'sticky'){ 444 scrollOffsetTolerance = headerHeight-1; 445 } 446 447 $logoImg.css('height', ((winWidth < 1024)?mobileLogoHeight:defaultLogoHeight)+'px'); 448 449 // Resizing video properly 450 if (window.MediaElementPlayer){ 451 updateVideosSizes(); 452 } 453 454 handleScroll(); 455 renderMenu(); 456 }; 457 458 if (window.MediaElementPlayer){ 459 jQuery('.video-background video').mediaelementplayer({ 460 enableKeyboard: false, 461 iPadUseNativeControls: false, 462 pauseOtherPlayers: false, 463 iPhoneUseNativeControls: false, 464 AndroidUseNativeControls: false, 465 videoWidth: '100%', 466 videoHeight: '100%', 467 success: function(mediaElement, domObject){ 468 updateVideosSizes(); 469 jQuery(domObject).css('display', 'block'); 470 } 471 }); 472 } 473 474 $body.on('click', 'a.w-toplink[href*="#"], a.w-logo-link[href*="#"], a.w-nav-anchor[href*="#"], a.g-btn[href*="#"], ' + 475 'a.smooth-scroll[href*="#"], a.w-icon-link[href*="#"], a.w-iconbox-link[href*="#"], a.bbp-reply-permalink[href*="#"], ' + 476 '.menu-item > a[href*="#"], a.w-blogpost-meta-comments-h[href*="#"], .w-comments-title a[href*="#"]', 477 function(event){ 478 479 var href = this.href, 480 hash = this.hash; 481 482 // Handling to other URLs or pages 483 if ( ! ( 484 href.charAt(0) == '#' || 485 (href.charAt(0) == '/' && href.test('^'+location.pathname+'#')) || 486 href.indexOf(location.host+location.pathname+'#') > -1 487 )) return; 488 489 event.preventDefault(); 490 event.stopPropagation(); 491 492 var scrollTop = 0; 493 if (this && hash != '#'){ 494 var $target = jQuery(this.hash); 495 if ($target.length){ 496 scrollTop = $target.offset().top - scrollOffsetTolerance; 497 } 498 } 499 500 jQuery("html, body").animate({ 501 scrollTop: scrollTop+"px" 502 }, { 503 duration: 1200, 504 easing: "easeInOutQuint" 505 }); 506 }); 507 508 if (scrollInit == false && document.location.hash && jQuery(document.location.hash).length){ 509 jQuery(window).load(function(){ 510 scrollInit = true; 511 512 jQuery("html, body").animate({ 513 scrollTop: jQuery(document.location.hash).offset().top-scrollOffsetTolerance+"px" 514 }, { 515 duration: 1200, 516 easing: "easeInOutQuint" 517 }); 518 }); 519 } 520 521 handleResize(); 522 523 $window.scroll(handleScroll); 524 525 // Recounting objects' positions when the resize is finished 526 var resizeTimer = null; 527 $window.resize(function(){ 528 clearTimeout(resizeTimer); 529 resizeTimer = setTimeout(handleResize, 100); 530 }); 531 532 $window.load(handleResize); 533 534 jQuery('.contact_form').each(function(){ 535 536 jQuery(this).submit(function(){ 537 var form = jQuery(this), 538 name, email, phone, message, 539 nameField = form.find('input[name=name]'), 540 emailField = form.find('input[name=email]'), 541 phoneField = form.find('input[name=phone]'), 542 messageField = form.find('textarea[name=message]'), 543 button = form.find('.g-btn'), 544 errors = 0; 545 546 button.addClass('loading'); 547 jQuery('.w-form-field-success').html(''); 548 549 if (nameField.length) { 550 name = nameField.val(); 551 552 if (name === '' && nameField.data('required') === 1){ 553 jQuery('#name_row').addClass('check_wrong'); 554 jQuery('#name_state').html(window.nameFieldError); 555 556 errors++; 557 } else { 558 jQuery('#name_row').removeClass('check_wrong'); 559 jQuery('#name_state').html(''); 560 } 561 } 562 563 if (emailField.length) { 564 email = emailField.val(); 565 566 if (email === '' && emailField.data('required') === 1){ 567 jQuery('#email_row').addClass('check_wrong'); 568 jQuery('#email_state').html(window.emailFieldError); 569 errors++; 570 } else { 571 jQuery('#email_row').removeClass('check_wrong'); 572 jQuery('#email_state').html(''); 573 } 574 } 575 576 if (phoneField.length) { 577 phone = phoneField.val(); 578 579 if (phone === '' && phoneField.data('required') === 1){ 580 jQuery('#phone_row').addClass('check_wrong'); 581 jQuery('#phone_state').html(window.phoneFieldError); 582 errors++; 583 } else { 584 jQuery('#phone_row').removeClass('check_wrong'); 585 jQuery('#phone_state').html(''); 586 } 587 } 588 589 if (messageField.length) { 590 message = messageField.val(); 591 592 if (message === '' && messageField.data('required') === 1){ 593 jQuery('#message_row').addClass('check_wrong'); 594 jQuery('#message_state').html(window.messageFieldError); 595 errors++; 596 } else { 597 jQuery('#message_row').removeClass('check_wrong'); 598 jQuery('#message_state').html(''); 599 } 600 } 601 602 if (errors === 0){ 603 jQuery.ajax({ 604 type: 'POST', 605 url: window.ajaxURL, 606 dataType: 'json', 607 data: { 608 action: 'sendContact', 609 name: name, 610 email: email, 611 phone: phone, 612 message: message 613 }, 614 success: function(data){ 615 if (data.success){ 616 jQuery('.w-form-field-success').html(window.messageFormSuccess); 617 618 if (nameField.length) { 619 nameField.val(''); 620 } 621 if (emailField.length) { 622 emailField.val(''); 623 } 624 if (phoneField.length) { 625 phoneField.val(''); 626 } 627 if (messageField.length) { 628 messageField.val(''); 629 } 630 } 631 632 button.removeClass('loading'); 633 }, 634 error: function(){ 635 } 636 }); 637 } else { 638 button.removeClass('loading'); 639 } 640 641 return false; 642 }); 643 644 }); 645 646 function preloaderProgress() { 647 preloaderLoadedImageCount++; 648 var percent = Math.round(preloaderLoadedImageCount/preloaderTotalImageCount*100); 649 jQuery('.l-preloader-counter').text(percent+"%"); 650 jQuery('.l-preloader-bar').stop().animate({ 651 "height": percent+"%" 652 }, 200); 653 } 654
655 function preloaderFinished() { 656 jQuery('.l-preloader-counter').text("100%"); 657 jQuery('.l-preloader-bar').stop().animate({ 658 "height": "100%" 659 }, 200); 660 window.setTimeout(function(){ 661 jQuery('.l-preloader' ).animate({height: 0}, 300, function () { 662 jQuery('.l-preloader').remove(); 663 handleResize(); 664 }); 665 }, 200); 666 } 667 668 if (jQuery('.l-preloader').length){ 669 var images = jQuery('.l-section').first().find('.l-subsection-hh > img'), 670 preloaderLoadedImageCount = 0, 671 preloaderTotalImageCount = 0, 672 preloaderContainer = jQuery('.l-preloader'); 673 674 jQuery('.l-subsection').each(function(){ 675 var el = jQuery(this) 676 , image = el.css('background-image').match(/url\((['"])?(.*?)\1\)/); 677 if(image) 678 images = images.add(jQuery('<img>').attr('src', image.pop())); 679 }); 680 681 if (preloaderContainer.hasClass('with_spinner')){ 682 images.imagesLoaded().always(function(){ 683 window.setTimeout(function(){ 684 jQuery('.l-preloader').animate({height: 0}, 300, function () { 685 jQuery('.l-preloader').remove(); 686 handleResize(); 687 }); 688 }, 200); 689 }); 690 } else { 691 preloaderTotalImageCount = images.length; 692 jQuery("<div class='l-preloader-bar'></div>").appendTo(preloaderContainer); 693 jQuery("<div class='l-preloader-counter'></div>").text("0%").appendTo(preloaderContainer); 694 695 images.imagesLoaded().progress(preloaderProgress).always(preloaderFinished); 696 } 697 } 698 699 700 jQuery('.no-touch .l-subsection.with_parallax').each(function(){ 701 jQuery(this).parallax('50%', '0.3'); 702 }); 703 704 jQuery(".w-clients-list").each(function() { 705 var clients = jQuery(this), 706 autoPlay = clients.attr('data-autoPlay'), 707 autoPlaySpeed = clients.attr('data-autoPlaySpeed'), 708 columns = clients.attr('data-columns'), 709 columns1300 = (columns < 4)?columns:4, 710 columns1024 = (columns < 3)?columns:3, 711 columns768 = (columns < 2)?columns:2, 712 infinite = false; 713 if (autoPlay == 1) { 714 autoPlay = infinite = true; 715 } else { 716 autoPlay = infinite = false; 717 } 718 clients.slick({ 719 infinite: infinite, 720 autoplay: autoPlay, 721 lazyLoad: 'progressive', 722 autoplaySpeed: autoPlaySpeed, 723 accessibility: false, 724 slidesToShow: columns, 725 responsive: [{ 726 breakpoint: 1300, 727 settings: { 728 slidesToShow: columns1300 729 } 730 },{ 731 breakpoint: 1024, 732 settings: { 733 slidesToShow: columns1024 734 } 735 },{ 736 breakpoint: 768, 737 settings: { 738 slidesToShow: columns768 739 } 740 },{ 741 breakpoint: 480, 742 settings: { 743 slidesToShow: 1 744 } 745 }] 746 }); 747 }); 748 749 if (jQuery().fotorama){ 750 jQuery('.fotorama').fotorama({ 751 spinner: { 752 lines: 13, 753 color: 'rgba(0, 0, 0, .75)' 754 } 755 }); 756 } 757}); 758 759// Disable FotoRama statistics usage 760window.blockFotoramaData = true; 761 762/** 763 * CSS-analog of jQuery slideDown/slideUp/fadeIn/fadeOut functions (for better rendering) 764 */ 765!function(){ 766 /** 767 * 768 * @param {Object} css key-value pairs of animated css 769 * @param {Number} duration 770 * @param {Function} onFinish 771 */ 772 jQuery.fn.performCSSTransition = function(css, duration, onFinish){ 773 duration = duration || 250; 774 var $this = this, 775 transition = []; 776 for (var attr in css){ 777 if ( ! css.hasOwnProperty(attr)) continue; 778 transition.push(attr+' '+(duration/1000)+'s ease-in-out'); 779 } 780 transition = transition.join(', '); 781 $this.css({ 782 transition: transition, 783 '-webkit-transition': transition 784 }); 785 786 // Stopping previous events, if there were any 787 var prevTimers = (this.data('animation-timers') || '').split(','); 788 if (prevTimers.length == 2){ 789 clearTimeout(prevTimers[0]); 790 clearTimeout(prevTimers[1]); 791 } 792 793 // Starting the transition with a slight delay for the proper application of CSS transition properties 794 var timer1 = setTimeout(function(){ 795 $this.css(css); 796 }, 25); 797 798 var timer2 = setTimeout(function(){ 799 if (typeof onFinish == 'function') onFinish(); 800 $this.css({ 801 transition: '', 802 '-webkit-transition': '' 803 }); 804 }, duration + 25); 805 806 this.data('animation-timers', timer1+','+timer2); 807 }; 808 // Height animations 809 jQuery.fn.slideDownCSS = function(){ 810 if (this.length == 0) return; 811 // Grabbing the "auto" height in px 812 this.css({ 813 visibility: 'hidden', 814 position: 'absolute', 815 height: 'auto', 816 display: 'block' 817 }); 818 var height = this.outerHeight(); 819 this.css({ 820 overflow: 'hidden', 821 height: '0px', 822 visibility: '', 823 position: '', 824 opacity: 0 825 }); 826 var $this = this; 827 this.performCSSTransition({ 828 height: height, 829 opacity: 1 830 }, arguments[0] || 250, function(){ 831 $this.css({ 832 overflow: '', 833 height: 'auto' 834 }); 835 }); 836 }; 837 jQuery.fn.slideUpCSS = function(){ 838 if (this.length == 0) return; 839 this.css({ 840 height: this.outerHeight(), 841 overflow: 'hidden', 842 opacity: 1 843 }); 844 var $this = this; 845 this.performCSSTransition({ 846 height: 0, 847 opacity: 0 848 }, arguments[0] || 250, function(){ 849 $this.css({overflow: '', display: 'none'}); 850 }); 851 }; 852 // Opacity animations 853 jQuery.fn.fadeInCSS = function(){ 854 if (this.length == 0) return; 855 this.css({ 856 opacity: 0, 857 display: 'block' 858 }); 859 this.performCSSTransition({ 860 opacity: 1 861 }, arguments[0] || 250); 862 }; 863 jQuery.fn.fadeOutCSS = function(){ 864 if (this.length == 0) return; 865 var $this = this; 866 this.performCSSTransition({ 867 opacity: 0 868 }, arguments[0] || 250, function(){ 869 $this.css('display', 'none'); 870 }); 871 }; 872 // Material design animations 873 jQuery.fn.showMD = function(){ 874 if (this.length == 0) return; 875 // Grabbing the "auto" height in px 876 this.css({ 877 visibility: 'hidden', 878 position: 'absolute', 879 height: 'auto', 880 display: 'block' 881 }); 882 var height = this.outerHeight(); 883 this.css({ 884 transform: 'translateY(-600px)', 885 '-webkit-transform': 'translateX(-600px)', 886 overflow: 'hidden', 887 height: '0px', 888 visibility: '', 889 position: '', 890 opacity: 0 891 }); 892 var $this = this; 893 this.performCSSTransition({ 894 height: height, 895 transform: 'translateY(0px)', 896 '-webkit-transform': 'translateY(0px)', 897 opacity: 1 898 }, arguments[0] || 250, function(){ 899 $this.css({ 900 overflow: '', 901 height: 'auto', 902 transform: '',
903 '-webkit-transform': '' 904 }); 905 }); 906 }; 907 jQuery.fn.hideMD = function(){ 908 if (this.length == 0) return; 909 var $this = this; 910 this.css({ 911 transform: '', 912 '-webkit-transform': '' 913 }); 914 this.performCSSTransition({ 915 opacity: 0 916 }, arguments[0] || 250, function(){ 917 $this.css('display', 'none'); 918 }); 919 }; 920}(); 921 922/** 923 * Retrieve/set/erase modificator class <mod>_<value> 924 * @param {String} mod Modificator namespace 925 * @param {String} [value] Value 926 * @returns {string|jQuery} 927 */ 928jQuery.fn.mod = function(mod, value){ 929 if (this.length == 0) return this; 930 // Remove class modificator 931 if (value === false){ 932 this.get(0).className = this.get(0).className.replace(new RegExp('(^| )'+mod+'\_[a-z0-9]+( |$)'), '$2'); 933 return this; 934 } 935 var pcre = new RegExp('^.*?'+mod+'\_([a-z0-9]+).*?$'), 936 arr; 937 // Retrieve modificator 938 if (value === undefined){ 939 return (arr = pcre.exec(this.get(0).className)) ? arr[1] : false; 940 } 941 // Set modificator 942 else { 943 this.mod(mod, false).get(0).className += ' '+mod+'_'+value; 944 return this; 945 } 946}; 947 948// Fixing hovers for devices with both mouse and touch screen 949jQuery.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 950jQuery('html').toggleClass('no-touch', ! jQuery.isMobile);
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.