1var $j = jQuery.noConflict(); 2windowHeight = $j(window).height(), 3 adminOffset = $j('body').hasClass('admin-bar') ? 32 : 0, 4 navOffset = $j('.logo').outerHeight(), 5 bannerType = $j('.top-banner').attr('id'), 6 scroll = $j(window).scrollTop(), 7 navHeight = $j("#main-nav").height(), 8 finalOffset = navOffset + adminOffset, 9 headerBreakPoint = 0, 10 headerContentWidth = 0, 11 mobileBreakPoint = 780, 12 masonry = $j('.masonry').length, 13 parallaxSkroll = false, 14 breakpoints = { 15 "Large": [9999, 3], // *3* columns for all larger screens 16 "Medium": [800, 2], // For *Medium* screens of *1100 to 700*, set Isotope to *2* columns 17 "Small": [500, 1] // For *Small* screens below *700*, set Isotope to *1* column 18 }; 19 20 21/** 22 * Mobile Detection 23 */ 24 25var isMobile = { 26 Android: function() { 27 return navigator.userAgent.match(/Android/i); 28 }, 29 BlackBerry: function() { 30 return navigator.userAgent.match(/BlackBerry/i); 31 }, 32 iOS: function() { 33 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 34 }, 35 Opera: function() { 36 return navigator.userAgent.match(/Opera Mini/i); 37 }, 38 Windows: function() { 39 return navigator.userAgent.match(/IEMobile/i); 40 }, 41 any: function() { 42 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 43 } 44}; 45 46/** 47 * Check if browser is IE 48 */ 49function isIE() { 50 if ($j('body').hasClass('ie')) { 51 ie = true; 52 } else { 53 ie = false;
54 } 55 return ie; 56} 57 58/** 59 * Check if browser is Edge 60 */ 61 62function isEdge() { 63 if (!!navigator.userAgent.match(/Edge/)) { 64 return true; 65 } 66} 67 68/** 69 * Header Setup 70 */ 71function menuSetup() { 72 // Misc. 73 // -- Hover menus 74 $j('ul.sf-menu').superfish({ 75 cssArrows: false, 76 speed: 'fast', 77 speedOut: 'fast', 78 }); 79} 80 81/** 82 * Replicate jQuery .each method 83 */ 84function forEachElement(selector, fn) { 85 var elements = document.querySelectorAll(selector); 86 for (var i = 0; i < elements.length; i++) fn(elements[i], i); 87} 88 89 90/** 91 * Masonry Blog Initialization 92 * 93 * Check to see if the layout mode is set to masonry, and 94 * defaults to fitRows if the .masonry class is not found. 95 * Initializes Isotope on the $gridContainer var 96 */ 97 98function initMasonryBlog() { 99 var gridContainer = $j('.blog .masonry'); 100 if (gridContainer.length) { 101 gridContainer.each(function() { 102 var $this = $j(this); 103 $this.waitForImages(function() { 104 $this.isotope({ 105 itemSelector: '.post.small', 106 resizable: true, 107 masonry: { 108 columnWidth: '' 109 } 110 }); 111 $j('.post.small').addClass('show'); 112 }); 113 }); 114 } 115} 116 117 118 119/** 120 * Filter Navigation 121 * 122 * Binds the Isotope filtering function to clicks on the 123 * portfolio filter links using the data-filter attribute 124 */ 125 126function filterInit() { 127 var $filterNavA = $j('#filter-nav a'); 128 $filterNavA.click(function() { 129 var selector = $j(this).attr('data-filter'); 130 $j(this).parents('.projects').find('.thumbs').isotope({ 131 filter: selector 132 }); 133 if (!$j(this).hasClass('selected')) { 134 $j(this).parents('#filter-nav').find('.selected').removeClass('selected'); 135 $j(this).addClass('selected'); 136 //$j(this).parent.addClass( 'selected' ); 137 } 138 return false; 139 }); 140} 141 142/** 143 * Portfolio Initialization 144 * 145 * Check to see if the layout mode is set to masonry, and 146 * defaults to fitRows if the .masonry class is not found. 147 * Initializes Isotope on the $gridContainer var 148 */ 149 150function initPortfolio() { 151 var gridContainer = $j('.projects .thumbs'); 152 if(gridContainer.length){ 153 154 masonryProjectResize(); 155 156 gridContainer.each(function(){ 157 var $this = $j(this); 158 $this.waitForImages(function(){ 159 160 $this.isotope({ 161 itemSelector: '.project.small', 162 resizable: false, 163 masonry: { 164 columnWidth: '.grid-sizer' 165 } 166 }); 167 $j('.projects .thumbs .project.small').addClass('show'); 168 }); 169 }); 170 } 171} 172 173/** 174 * Resize Masonry Grid Items 175 * 176 */ 177 178function masonryProjectResize() { 179 if ($j('.masonry-with-gutter').length || $j('.masonry-without-gutter').length) { 180 var defaultSize = $j('.projects .grid-sizer').width(); 181 var projectDefault = $j('.projects .project.small'); 182 var projectMasonryDefault = $j('.projects .masonry-default'); 183 var projectMasonryWide = $j('.projects .masonry-wide'); 184 var projectMasonryTall = $j('.projects .masonry-tall'); 185 var projectMasonryWideTall = $j('.projects .masonry-wide_tall'); 186 projectDefault.css('height', defaultSize); 187 projectMasonryDefault.css('height', defaultSize); 188 projectMasonryWide.css('height', defaultSize); 189 projectMasonryTall.css('height', defaultSize * 2); 190 projectMasonryWideTall.css('height', defaultSize * 2); 191 projectMasonryWideTall.css('width', defaultSize * 2); 192 } 193} 194 195 196/* 197 ** Load More Projects 198 */ 199 200function loadMoreProjects() { 201 if ($j('.projects .load-more-button').length) { 202 var i = 1; 203 204 $j('.load-more-button a').on('click', function(e) { 205 e.preventDefault(); 206 var gridContainer = $j('.projects .thumbs'); 207 var link = $j(this).attr('href'); 208 var $content = '.projects .thumbs'; 209 var $anchor = '.projects .load-more-button a'; 210 var $next_href = $j($anchor).attr('href'); // Get URL for the next set of projects 211 var loadMoreButton = $j('.projects .load-more-holder .load-more-button'); 212 var loading = $j('.projects .load-more-holder .loading'); 213
214 loadMoreButton.addClass('hidden'); 215 loading.removeClass('hidden'); 216 $j.get(link + '', function(data) { 217 218 219 var $new_content = $j($content, data).wrapInner('').html(); // Load only the projects 220 $next_href = $j($anchor, data).attr('href'); // Get the new href 221 222 $j($content, data).waitForImages(function() { 223 224 $j('.projects .thumbs .project.small:last').after($new_content); // Append the new projects 225 226 masonryProjectResize(); 227 gridContainer.isotope('on', 'layoutComplete', 228 function(laidOutItems) { 229 $j('.project.small:not(.show)').addClass('show'); 230 } 231 ); 232 gridContainer.isotope('reloadItems').isotope(); 233 234 235 if ($j('.load-more-button').data('rel') > i) { 236 $j('.load-more-button a').attr('href', $next_href); // Change the next URL 237 } else { 238 $j('.load-more-button').remove(); 239 } 240 241 loadMoreButton.removeClass('hidden'); 242 loading.addClass('hidden'); 243 }); 244 }); 245 i++; 246 }); 247 } 248} 249 250 251/** 252 * Slide Nav Setup 253 */ 254 255function initMobileSlideMenu() { 256 var siteContainer = $j('#site-wrap'); 257 slideMenu = $j('#slide-panel'); 258 slideMenuHeight = slideMenu.innerHeight(); 259 $j('.hamburger').on('click', function() { 260 $j(this).toggleClass('is-active'); 261 slideMenu.stop(true,true).slideToggle("slow"); //easeInOutSine works also nice at 200ms 262 return false; 263 }); 264} 265 266function initSlideMenu(){ 267 var siteContainer = $j('#site-wrap'); 268 slideMenu = $j('#slide-panel'); 269 slideMenuWidth = slideMenu.outerWidth(); 270 $j('.menu-toggle.open').on('click', function () { 271 slideMenu.css('display', 'block'); 272 slideMenu.css('transform', 'translateX(0)'); 273 }); 274 $j('#menu-toggle-close').on('click', function () { 275 slideMenu.css('transform', 'translateX(' + slideMenuWidth + 'px)'); 276 }); 277 var browserWidth = $j(window).width(); 278 if(isMobile.any() && browserWidth < 768) { 279 var browserWidth = $j(window).width(); 280 slideMenuWidth = browserWidth; 281 slideMenu.css('width', browserWidth + 'px'); 282 } 283 slideMenu.css('transform', 'translateX(' + slideMenuWidth + 'px)'); 284 slideMenu.css('visibility', 'visible'); 285} 286 287/** 288 * Mobile Menu Submenus 289 * Set collapsable submenus. 290 */ 291// Toggle sub menus 292function initMobileSubMenus() { 293 jQuery("#slide-panel nav").find("li.menu-item-has-children").click(function() { 294 jQuery("#slide-panel nav").not(this).find("ul").next().slideToggle(100); 295 jQuery(this).find("> ul").stop(true, true).slideToggle(100); 296 jQuery(this).toggleClass("active-sub-menu"); 297 return false; 298 }); 299 300 // Don't fire sub menu toggle if a user is trying to click the link 301 jQuery(".menu-item-has-children a").click(function(e) { 302 e.stopPropagation(); 303 return true; 304 }); 305} 306 307 308 309/** 310 * Header Search Setup 311 */ 312 313function initHeaderSearch() { 314 var headerSearchBar = $j('.header-search'); 315 $j('.search-toggle.open').on('click', function() { 316 headerSearchBar.addClass('open'); 317 headerSearchBar.find('#s').focus(); 318 }); 319 $j('.search-toggle.close').on('click', function() { 320 headerSearchBar.removeClass('open'); 321 headerSearchBar.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) { 322 headerSearchBar.addClass('finished'); 323 }); 324 }); 325} 326 327/** 328 * Single Page Nav Links 329 */ 330 331function initSinglePageNav() { 332 lastId = ""; 333 topMenu = $j('#site-header .main-nav'); 334 headerHeight = 0; 335 adminBarHeight = $j('body').hasClass('admin-bar') ? 32 : 0; 336 scrollOffest = adminBarHeight + headerHeight; 337 // All list items 338 menuItems = topMenu.find("a"); 339 // Anchors corresponding to menu items 340 scrollItems = menuItems.map(function() { 341 var target = this.hash; 342 var item = $j(target); 343 if (item.length) { 344 return item; 345 } 346 }); 347 $j('.main-nav a[href^="#"], #slide-mobile-menu a[href^="#"]').click(function(e) { 348 e.preventDefault(); 349 var target = this.hash; 350 var targetElement = $j(target); 351 $j(window).scrollTo(targetElement, { 352 353 duration: 500, 354 interrupt: false, 355 offset: -(scrollOffest+59) 356 }); 357 358 }); 359} 360 361function singlePageNavScroll() { 362 // Get container scroll position 363 var fromTop = $j(this).scrollTop() + scrollOffest + 140; 364 // Get id of current scroll item 365 var cur = scrollItems.map(function() { 366 if ($j(this).offset().top <= fromTop) 367 return this; 368 }); 369 // Get the id of the current element 370 cur = cur[cur.length - 1]; 371 var id = cur && cur.length ? cur.attr("id") : ""; 372 if (lastId !== id) { 373 //alert(id); 374 375 //alert(cur.data("rowId")); 376 lastId = id; 377 // Set/remove active class 378 menuItems.parent().removeClass("active"); 379 $j("[href=#" + id + "]").parent().addClass("active"); 380 } 381} 382 383/** 384 * Init lightbox links 385 */ 386 387 388function initLightbox() { 389 if($j("body").hasClass("lb-fancyBox")){ 390 $j("a[rel^='prettyPhoto']").removeAttr('rel').attr('data-fancybox', 'gallery'); 391 $j('a[href*=".gif"], a[href*=".jpg"], a[href*=".png"], a[href*=".bmp"]').attr('data-fancybox', 'gallery'); 392 }else{ 393 if($j("a[data-rel^='prettyPhoto']").length){ 394 $j("a[data-rel^='prettyPhoto']").prettyPhoto({ 395 hook: 'data-rel', 396 social_tools: '', 397 autoplay: false, 398 show_title: false, 399 deeplinking: false, 400 overlay_gallery: false, 401 markup: '<div class="pp_pic_holder"> \ 402 <div class="ppt"> </div> \ 403 <div class="pp_top"> \ 404 <div class="pp_left"></div> \ 405 <div class="pp_middle"></div> \ 406 <div class="pp_right"></div> \ 407 </div> \ 408 <div class="pp_content_container"> \ 409 <div class="pp_left"> \ 410 <div class="pp_right"> \ 411 <div class="pp_content"> \ 412 <div class="pp_loaderIcon"></div> \ 413 <div class="pp_fade"> \ 414 <a href="#" class="pp_expand" title="Expand the image">Expand</a> \ 415 <div class="pp_hoverContainer"> \ 416 <a class="pp_next" href="#"></a> \ 417 <a class="pp_previous" href="#"></a> \ 418 </div> \ 419 <div id="pp_full_res"></div> \ 420 <div class="pp_details"> \ 421 <p class="currentTextHolder">0/0</p> \ 422 <a class="pp_close" href="#"></a> \ 423 </div> \ 424 </div> \ 425 </div> \ 426 </div> \ 427 </div> \ 428 </div> \ 429 <div class="pp_bottom"> \ 430 <div class="pp_left"></div> \ 431 <div class="pp_middle"></div> \ 432 <div class="pp_right"></div> \ 433 </div> \ 434 </div> \ 435 <div class="pp_overlay"></div>', 436 }); 437 } 438 } 439} 440 441/** 442 * Parallax 443 */ 444 445function initParallax() { 446 if (isEdge()) { 447 return false;
448 } 449 $j('.parallax-inner').remove(); 450 $j('.parallax-section').each(function() { 451 var skrollrSpeed, 452 skrollrSize, 453 skrollrStart, 454 skrollrEnd, 455 parallaxSectionId, 456 $parallaxElement, 457 parallaxSectionHeight, 458 parallaxImage; 459 parallaxSectionId = $j(this).data('parallaxId'); 460 parallaxSection = $j(this); 461 var pOffset = parallaxSection.offset(); //Get the offset of the parallax section 462 var pOffsetTop = pOffset.top; 463 $parallaxElement = $j('<div />').addClass('parallax-inner').appendTo($j(this)); 464 if (pOffsetTop < 100) { 465 parallaxSection.addClass('top'); 466 } 467 $parallaxElement.attr('data-parallax', '{"y": 330, "distance": 2000, "smoothness": 0}'); 468 if (!isMobile.any()) {} 469 }); 470} 471 472 473function ieParallax() { 474 $j('.parallax-section').each(function() { 475 var parallaxSection = $j(this); 476 parallaxSection.css({ 477 'background-attachemnt': 'fixed' 478 }); 479 }); 480} 481 482/** 483* Sticky Header 484*/ 485 486function stickyHeader(){ 487 var fromTop = $j(document).scrollTop(); 488 $j('.sticky-header #site-header').toggleClass("sticky", (fromTop > 100)); 489} 490 491function initStickyHeader(){ 492 var stickyHeader = $j('.sticky-header #site-header'); 493 if(!stickyHeader.hasClass('transparent') && $j('body').hasClass('sticky-header')){ 494 stickyHeader.waitForImages(function() { 495 headerHeight = stickyHeader.height(); 496 $j('#middle').css('padding-top', headerHeight); 497 }); 498 } 499 $j('#middle').css('opacity', 1); 500} 501 502function makeHeaderMobileFriendly(){ 503 504 var mobileBreakpoint = $j('body').attr('data-mobile-breakpoint'); 505 if($j(window).width() < parseInt(mobileBreakpoint)){ 506 if($j('#site-header').hasClass("is-transparent")){ 507 $j('#site-header').removeClass("transparent"); 508 } 509 if($j('body').hasClass("has-sticky-header")){ 510 $j('body').removeClass("sticky-header"); 511 $j('#middle').css('padding-top', 0); 512 513 } 514 }else{ 515 if($j('#site-header').hasClass("is-transparent")){ 516 $j('#site-header').addClass("transparent"); 517 } 518 if($j('body').hasClass("has-sticky-header")){ 519 $j('#middle').css('padding-top', headerHeight); 520 $j('body').addClass("sticky-header"); 521 } 522 } 523} 524 525 526/** 527 * Megamenu width 528 */ 529 530function megamenuWidth() { 531 var headerWidth = $j('#site-header .logo-and-nav').outerWidth(); 532 $j('.mega-menu.full-width ul').css('width', headerWidth + 'px'); 533} 534 535 536 537/** 538 * Scroll to top button 539 */ 540 541function initScrollToTopButton() { 542 if ($j('#scroll-to-top')) { 543 $j('#scroll-to-top').click(function(e) { 544 $j(window).scrollTo(0, { 545 duration: 500, 546 interrupt: false 547 }); 548 }) 549 } 550} 551 552function scrollToTopButton() { 553 if ($j('#scroll-to-top')) { 554 var fromTop = $j(document).scrollTop(); 555 $j('#scroll-to-top').toggleClass("active", (fromTop > 200)); 556 } 557} 558 559 560/** 561 * Set poster image for background videos in Slider Revolution 562 */ 563function revSliderMobilePoster() { 564 var mobile = 'ontouchend' in window; 565 $j('.tp-videolayer').each(function() { 566 var $this = $j(this); 567 if (!mobile) { 568 // to keep the video poster for desktop, comment out or remove the line below 569 $this.attr('data-videoposter', ''); 570 return; 571 } 572 $this.removeClass('fullscreenvideo tp-videolayer').addClass('mobile-video-fallback-image').css( 573 'background-image', 'url(' + $this.attr('data-videoposter') + ')' 574 ); 575 }); 576} 577 578/** 579 * Fix mouse wheel zoom on Google Maps 580 */ 581function fixGoogleMapMouseWheelZoom() { 582 $j('.sow-google-map-canvas').addClass('scroll-off'); // set the pointer events to none on doc ready 583 $j('.widget_sow-google-map').on('click', function() { 584 $j('.sow-google-map-canvas').removeClass('scroll-off'); // set the pointer events true on click 585 }); 586 // disable pointer events when the mouse leave the canvas area; 587 $j(".widget_sow-google-map").mouseleave(function() { 588 $j('.sow-google-map-canvas').addClass('scroll-off'); // set the pointer events to none when mouse leaves the map area 589 }); 590} 591 592 593/** 594 * Fade out preloader 595 */ 596$j(window).load(function() { 597 $j('body').addClass('loaded'); 598 $j('#loader-container').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) { 599 $j('#loader-container').addClass('finished'); 600 }); 601}) 602 603 604/** 605 * Fix mouswheel scroll in IE for fixed backgrounds 606 */ 607 608if (navigator.userAgent.match(/Trident\/7\./)) { // if IE 609 $j('body').on("mousewheel", function() { 610 // remove default behavior 611 event.preventDefault(); 612 613 //scroll without smoothing 614 var wheelDelta = event.wheelDelta; 615 var currentScrollPosition = window.pageYOffset; 616 window.scrollTo(0, currentScrollPosition - wheelDelta); 617 }); 618} 619 620/** 621 * Fade In Items on Scroll 622 */ 623 624function fadeInItems() { 625 $j('.project.small').each(function(i) { 626 627 var bottom_of_object = $j(this).offset().top + $j(this).outerHeight(); 628 var bottom_of_window = $j(window).scrollTop() + $j(window).height(); 629 630 /* If the object is completely visible in the window, fade it it */ 631 if (bottom_of_window > bottom_of_object) { 632 var offset = $j(this).offset();
633 var delay = offset.left * .3; 634 $j(this).delay(delay).animate({ 635 'opacity': '1', 636 'margin-top': 0, 637 }, 500); 638 639 } 640 641 }); 642} 643 644 645/** 646 * Init Counter 647 */ 648 649function initCounter() { 650 651 $j(".counter-number").each(function() { 652 var $countTo = parseInt($j(this).text()); 653 $j(this).waypoint(function() { 654 $j(this).countTo({ 655 from: 0, 656 to: $countTo, 657 speed: 900, 658 refreshInterval: 25 659 }); 660 }, { 661 triggerOnce: true, 662 offset: '99%' 663 }); 664 }); 665} 666 667 668/** 669 * Carousel 670 */ 671 672function initCarousel(){ 673 $j('.weston-carousel').each(function() { 674 675 var columns = 3; 676 var tabletcolumns = 3; 677 var nav = true; 678 var pagination = true; 679 var autoplay = false; 680 var loop = false; 681 var animationtime = 4000; 682 683 columns = $j(this).data("columns"); 684 tabletcolumns = $j(this).data("tabletcolumns"); 685 nav = $j(this).data("nav"); 686 pagination = $j(this).data("pagination"); 687 autoplay = $j(this).data("autoplay"); 688 loop = $j(this).data("loop"); 689 animationtime = $j(this).data("animationtime"); 690 691 $j(this).on('initialized.owl.carousel', function(event){ 692 $j(this).css('display', 'block'); 693 $j(this).animate({'opacity': 1}, 600); 694 }); 695 696 $j(this).owlCarousel({ 697 items : columns, 698 autoplay: autoplay, 699 autoplayTimeout: $j(this).data("animationtime"), 700 loop: loop, 701 dots: pagination, 702 nav: false, 703 center: false, 704 smartSpeed: 500, 705 autoheight: false, 706 navText: "", 707 responsive:{ 708 0:{ 709 items:1 710 }, 711 480:{ 712 items:tabletcolumns 713 }, 714 980:{ 715 items:columns 716 } 717 } 718 }); 719 720 }); 721} 722 723/** 724* Video Background 725*/ 726function resizeVideoBackground() { 727 728 var min_w = 1200; // minimum video width allowed 729 var video_width_original = 1280; // original video dimensions 730 var video_height_original = 720; 731 var vid_ratio = 1280/720; 732 $j('.video-wrap').each(function(i){ 733 734 var $sectionHeight = $j(this).parent('.vc_row').outerHeight(); 735 var $sectionWidth = $j(this).parent('.vc_row').outerWidth(); 736 737 $j(this).width($sectionWidth); 738 $j(this).height($sectionHeight); 739 740 // calculate scale ratio 741 var scale_h = $sectionWidth / video_width_original; 742 var scale_v = ($sectionHeight - $sectionHeight) / video_height_original; 743 var scale = scale_h > scale_v ? scale_h : scale_v; 744 745 // limit minimum width 746 min_w = vid_ratio * ($sectionHeight+20); 747 748 if (scale * video_width_original < min_w) {scale = min_w / video_width_original;} 749 750 $j(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original + 20)); 751 $j(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original + 20)); 752 753 $j(this).scrollLeft(($j(this).find('video').width() - $sectionWidth) / 2); 754 $j(this).scrollTop(($j(this).find('video').height() - ($sectionHeight)) / 2); 755 756 $j(this).find('.mejs-overlay, .mejs-poster').scrollTop(($j(this).find('video').height() - ($sectionHeight)) / 2); 757 758 }); 759} 760 761/** 762* VC Tweaks 763*/ 764function vcTweaks(){ 765 $j('.vc_pie_chart').each(function(i) { 766 var color = $j(this).data("pie-color"); 767 $j(this).css('color', color); 768 }); 769 770 $j('.progressbar').each(function() { 771 $j(this).waypoint(function(){ 772 var perc = $j(this).attr('data-perc'); 773 $j(this).find('.progress-percentage').animate({ "width" : perc + "%"}, perc*14); 774 },{ offset: '96%' }); 775 }); 776} 777 778 779/** 780*Number Field 781*/ 782// Number Field Stepper 783function initNumberFields(){ 784 $j('.single-product .qty').bootstrapNumber({ 785 upClass: 'plus', 786 downClass: 'minus' 787 }); 788} 789 790 791/** Shape Dividers **/ 792function shapeDivider () { 793 var $shape = '.weston-divider-wrap'; 794 795 forEachElement($shape, function($el, i) { 796 var elH = parseInt( $el.getAttribute('data-height') ), 797 elHunit = $el.getAttribute('data-unit'), 798 newEl, 799 $parent = $el.parentNode, 800 parentH, 801 $svg = $el.getElementsByTagName('svg')[0]; 802 803 if ( elHunit == 'px' ) { 804 805 switch (true) { 806 case (windowWidth < 1500 && windowWidth >= 1180): 807 newEl = elH*0.8; 808 break; 809
810 case (windowWidth < 1180 && windowWidth >= 960): 811 newEl = elH*0.65; 812 break; 813 814 case (windowWidth < 960 && windowWidth >= 570): 815 newEl = elH*0.5; 816 break; 817 818 case (windowWidth < 570): 819 newEl = elH*0.25; 820 break; 821 822 default: 823 newEl = elH; 824 } 825 826 $el.style.height = newEl + elHunit; 827 } 828 829 830 if ( classie.hasClass($el, 'weston-divider-preserve-ratio') && ( window.navigator.userAgent.indexOf('MSIE ') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 ) ) { 831 832 $svg.setAttribute('preserveAspectRatio','none'); 833 834 var sizes = $svg.getAttribute('viewBox').split(' '), 835 svgW = sizes[2], 836 svgH = sizes[3], 837 newSvgW; 838 839 newSvgW = newEl * ( svgW / svgH ); 840 841 $svg.style.width = newSvgW + 'px'; 842 843 } 844 }); 845}; 846 847/** Init 3D Parallax Hover **/ 848 849function init3DHover(){ 850 if($j('.material.product').length > 0 || $j('.w-active-box[data-style="3d_parallax"]').length > 0){ 851 852 $productZindex = 101; 853 $j('body').on('mouseenter','.material.product, .w-active-box[data-style="3d_parallax"]',function(){ 854 855 $productZindex++; 856 857 $j(this).css('z-index',$productZindex+1); 858 859 }); 860 $j('body').on('mouseleave','.material.product, .w-active-box[data-style="3d_parallax"]',function(){ 861 862 var $that = $j(this); 863 setTimeout(function(){ if(!$that.is(':hover')) $that.css('z-index',100); },280); 864 }); 865 866 //reset to stop zindex from getting too high 867 setInterval(function(){ 868 if($j('.w-active-box[data-style="3d_parallax"]:hover').length > 0) { 869 return; 870 } 871 $j('.material.product:not(:hover), .w-active-box[data-style="3d_parallax"]:not(:hover)').css('z-index',100); 872 $productZindex = 101; 873 },10000); 874 875 } 876} 877 878 879 880function ParallaxHover(){ 881 882 //change sizer pos 883 $j('.3d-parallax').each(function(){ 884 $j(this).find('.sizer').insertBefore($j(this).find('.parallaxImg')); 885 }); 886 887 //set parent zindex 888 $j('.3d-parallax').parents('.wpb_row').css('z-index','100'); 889 890 var d = document, 891 de = d.documentElement, 892 bd = d.getElementsByTagName('body')[0], 893 htm = d.getElementsByTagName('html')[0], 894 win = window, 895 imgs = d.querySelectorAll('.parallaxImg'), 896 totalImgs = imgs.length, 897 supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints; 898 899 if(totalImgs <= 0){ 900 return; 901 } 902 903 // build HTML 904 for(var l=0;l<totalImgs;l++){ 905 906 var thisImg = imgs[l], 907 layerElems = thisImg.querySelectorAll('.parallaxImg-layer'), 908 totalLayerElems = layerElems.length; 909 910 if(totalLayerElems <= 0){ 911 continue; 912 } 913 914 while(thisImg.firstChild) { 915 thisImg.removeChild(thisImg.firstChild); 916 } 917 918 var lastMove = 0; 919 920 //throttle performance for all browser other than chrome 921 var eventThrottle = $j('html').hasClass('cssreflections') ? 1 : 80; 922 if(eventThrottle == 80) $j('body').addClass('cssreflections'); 923 924 var containerHTML = d.createElement('div'), 925 shineHTML = d.createElement('div'), 926 shadowHTML = d.createElement('div'), 927 layersHTML = d.createElement('div'), 928 layers = []; 929 930 thisImg.id = 'parallaxImg__'+l; 931 containerHTML.className = 'parallaxImg-container'; 932 //shineHTML.className = 'parallaxImg-shine'; 933 shadowHTML.className = 'parallaxImg-shadow'; 934 layersHTML.className = 'parallaxImg-layers'; 935 936 for(var i=0;i<totalLayerElems;i++){ 937 var layer = d.createElement('div'), 938 layerInner = d.createElement('div'), 939 imgSrc = layerElems[i].getAttribute('data-img'); 940 941 $j(layer).html($j(layerElems[i]).html()); 942 layer.className = 'parallaxImg-rendered-layer'; 943 layer.setAttribute('data-layer',i); 944 945 if(i==0 && $j(thisImg).parents('.wpb_gallery').length == 0) { 946 layerInner.className = 'bg-img'; 947 layerInner.style.backgroundImage = 'url('+imgSrc+')'; 948 layer.appendChild(layerInner); 949 } 950 layersHTML.appendChild(layer); 951 952 layers.push(layer); 953 } 954 955 containerHTML.appendChild(layersHTML); 956 //containerHTML.appendChild(shineHTML); 957 thisImg.appendChild(containerHTML); 958 $j(thisImg).wrap('<div class="parallaxImg-wrap" />'); 959 if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { $j(thisImg).parent().append(shadowHTML); } 960 961 var w = thisImg.clientWidth || thisImg.offsetWidth || thisImg.scrollWidth; 962 //thisImg.style.transform = 'perspective('+ w*3 +'px)'; 963 964 if(supportsTouch && $j('body.using-mobile-browser').length > 0 ){ 965 966 } else { 967 (function(_thisImg,_layers,_totalLayers,_shine) { 968 $j(thisImg).parents('.3d-parallax').on('mousemove', function(e){ 969 970 var parentEl = $j(this); 971 var now = Date.now(); 972 if (now > lastMove + eventThrottle) { 973 lastMove = now; 974 window.requestAnimationFrame(function(){ 975 processMovement(e,false,_thisImg,_layers,_totalLayers,_shine,parentEl); 976 }); 977 } 978 979 //window.requestAnimationFrame(function(){ 980 // processShineMovement(e,false,_thisImg,_layers,_totalLayers,_shine); 981 //}); 982 }); 983 $j(thisImg).parents('.3d-parallax').on('mouseenter', function(e){ 984 processEnter(e,_thisImg,_layers,_totalLayers,_shine); 985 }); 986 $j(thisImg).parents('.3d-parallax').on('mouseleave', function(e){ 987 processExit(e,_thisImg,_layers,_totalLayers,_shine); 988 }); 989 })(thisImg,layers,totalLayerElems,shineHTML); 990 } 991 992 //set the depths 993 (function(_thisImg,_layers,_totalLayers,_shine) { 994 depths(false,_thisImg,_layers,_totalLayers,_shine); 995 window.addEventListener('resize', function(e){ 996 depths(false,_thisImg,_layers,_totalLayers,_shine); 997 }); 998 })(thisImg,layers,totalLayerElems,shineHTML); 999 } 1000 1001 function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl){ 1002 1003 //stop raf if exit already called 1004 if(!$j(elem.firstChild).hasClass('over')) { processExit(e,elem,layers,totalLayers,shine); return false } 1005 1006 //set up multipliers 1007 1008 if($j(elem).parents('.col.wide').length > 0 ) { 1009 var yMult = 0.03; 1010 var xMult = 0.063; 1011 } else if( $j(elem).parents('.col.regular').length > 0 || $j(elem).parents('.wpb_gallery').length > 0) { 1012 var yMult = 0.045; 1013 var xMult = 0.045; 1014 } else if($j(elem).parents('.col.tall').length > 0 ) { 1015 var yMult = 0.05; 1016 var xMult = 0.015; 1017 } else if($j(elem).parents('.col.wide_tall').length > 0) { 1018 var yMult = 0.04; 1019 var xMult = 0.04; 1020 } else if(parentEl.hasClass('w-active-box')) { 1021 var yMult = 0.045; 1022 var xMult = 0.022; 1023 } else { 1024 var yMult = 0.045; 1025 var xMult = 0.075; 1026 } 1027 1028 var bdst = $j(window).scrollTop(), 1029 bdsl = bd.scrollLeft, 1030 pageX = (touchEnabled)? e.touches[0].pageX : e.pageX, 1031 pageY = (touchEnabled)? e.touches[0].pageY : e.pageY, 1032 offsets = elem.getBoundingClientRect(), 1033 w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width 1034 h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height 1035 wMultiple = 320/w, 1036 offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X 1037 offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y 1038 dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container 1039 dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container 1040 yRotate = (offsetX - dx)*(yMult * wMultiple), //rotation for container Y 1041 xRotate = (dy - offsetY)*(xMult * wMultiple); //rotation for container X //old 1042
1043 //imgCSS = ' rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0)'; //img transform 1044 1045 if($j(elem).parents('.wpb_gallery').length > 0) { 1046 var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + -xRotate*1.9 + 'deg) rotateY(' + -yRotate*1.3 + 'deg)'; //img transform 1047 } else { 1048 if($j(elem).parents('.wide_tall').length == 0 && $j(elem).parents('.wide').length == 0 && $j(elem).parents('.tall').length == 0) { 1049 var $scaleAmount = (parentEl.hasClass('w-active-box')) ? '1.06' : '1.03'; 1050 var $offsetAmount = (parentEl.hasClass('w-active-box')) ? '-2' : '-10'; 1051 1052 var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY('+offsetY*$offsetAmount+'px) translateX('+offsetX*$offsetAmount+'px) scale('+$scaleAmount+')'; //img transform 1053 } else { 1054 var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px) scale(1.013)'; //img transform 1055 } 1056 } 1057 //imgCSS2 = 'perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0) translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px)'; //img transform //old 1058 1059 1060 //container transform 1061 if(elem.firstChild.className.indexOf(' over') != -1){ 1062 if($j(elem).parents('.portfolio-items.masonry-items').length > 0){ 1063 //imgCSS2 = ' scale3d(1.025,1.025,1.025)'; 1064 } else { 1065 //imgCSS2 = ' scale3d(1.06,1.06,1.06)'; 1066 } 1067 1068 1069 1070 } 1071 1072 //elem.firstChild.style.transform = imgCSS; 1073 $j(elem).find('.parallaxImg-container').css('transform',imgCSS); 1074 1075 if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { 1076 $j(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform',imgCSS); 1077 } 1078 //elem.style.transform = imgCSS2; 1079 1080 1081 } 1082 1083 function processEnter(e, elem, layers, totalLayers, shine){ 1084 1085 elem.firstChild.className += ' over'; 1086 elem.className += ' over'; 1087 1088 //if(Idx == -1) { 1089 //$j('body').addClass('cssreflections'); 1090 //$j(elem).addClass('transition'); 1091 // //var $timeout = setTimeout(function(){ $j(elem).removeClass('transition'); },150); 1092 //} else { 1093 $j(elem).addClass('transition'); 1094 1095 if($j(elem).parents('.wpb_gallery').length > 0) { 1096 var $timeout = setTimeout(function(){ $j(elem).removeClass('transition'); },450); 1097 } else { 1098 var $timeout = setTimeout(function(){ $j(elem).removeClass('transition'); },200); 1099 } 1100 //} 1101 1102 //depths(false, elem, layers, totalLayers, shine); 1103 } 1104 1105 function processExit(e, elem, layers, totalLayers, shine){ 1106 1107 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 1108 var container = elem.firstChild; 1109 1110 container.className = container.className.replace(' over',''); 1111 elem.className = elem.className.replace(' over',''); 1112 $j(container).css('transform', 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 1113 $j(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform','perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)'); 1114 1115 $j(elem).addClass('transition'); 1116 var $timeout = setTimeout(function(){ $j(elem).removeClass('transition'); },200); 1117 1118 //removeDepths(false, elem, layers, totalLayers, shine); 1119 1120 } 1121 1122 function depths(touchEnabled, elem, layers, totalLayers, shine) { 1123 1124 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 1125 var revNum = totalLayers; 1126 var container = elem.firstChild; 1127 1128 //set z 1129 for(var ly=0;ly<totalLayers;ly++){ 1130 //layers[ly].style.transform = 'translateX(' + (offsetX * revNum) * ((ly * 2.5) / wMultiple) + 'px) translateY(' + (offsetY * totalLayers) * ((ly * 2.5) / wMultiple) + 'px) translateZ(0)'; 1131 if(ly == 0) $j(layers[ly]).css('transform', 'translateZ(0px)'); 1132 else $j(layers[ly]).css('transform','translateZ(' +(w*3)/27*(ly*1.1) + 'px) '); 1133 1134 revNum--; 1135 } 1136 1137 totalLayers = totalLayers + 3; 1138 1139 //set perspective from beginning 1140 $j(container).css('transform','perspective('+ w*3 +'px)'); 1141 1142 //$j(elem).parents('.col').find('.parallaxImg-shine').css('transform','translateZ('+(w*3)/70*(totalLayers*1.1) +'px)'); 1143 } 1144 1145 function removeDepths(touchEnabled, elem, layers, totalLayers, shine) { 1146 1147 var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth; 1148 var revNum = totalLayers; 1149 1150 //set z 1151 for(var ly=0;ly<totalLayers;ly++){ 1152 1153 if(ly == 0) $j(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)'); 1154 else $j(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)'); 1155 1156 revNum--; 1157 } 1158 1159 totalLayers = totalLayers + 3; 1160 1161 } 1162} 1163 1164ParallaxHover(); 1165 1166 1167function revealFooter() { 1168 if ($j("body").hasClass("footer-reveal")) {
1169 var footer = $j('#footer'); 1170 var main = $j('#main'); 1171 var win = $j(window); 1172 1173 1174 if (footer.outerHeight() <= win.outerHeight() && footer.offset().top >= win.outerHeight()) { 1175 footer.css({ 1176 'z-index' : -999, 1177 position : 'fixed', 1178 bottom : 0 1179 }); 1180 1181 main.css({ 1182 'margin-bottom' : footer.outerHeight(), 1183 'position' : 'relative', 1184 'background' : '#fff', 1185 'z-index' : 500, 1186 }); 1187 1188 win.on('load resize footerRevealResize', function() { 1189 footer.css({ 1190 'width' : main.outerWidth() 1191 }); 1192 main.css({ 1193 'margin-bottom' : footer.outerHeight(), 1194 'position' : 'relative !important', 1195 'background' : '#fff', 1196 'z-index' : '9999 !important', 1197 }); 1198 }); 1199 } 1200 } 1201}; 1202 1203 1204 1205/** 1206* Initialize Everything 1207*/ 1208 1209$j(document).ready(function() { 1210 initSlideMenu(); 1211 initMobileSlideMenu(); 1212 $j(".content-area").fitVids(); 1213 initNumberFields() 1214 menuSetup(); 1215 filterInit();
1216 loadMoreProjects(); 1217 initSinglePageNav(); 1218 initStickyHeader(); 1219 initHeaderSearch(); 1220 megamenuWidth(); 1221 initMobileSubMenus(); 1222 //revSliderMobilePoster(); 1223 initScrollToTopButton(); 1224 fixGoogleMapMouseWheelZoom(); 1225 initCounter(); 1226 vcTweaks(); 1227 makeHeaderMobileFriendly(); 1228 $j( "div.gallery br" ).remove(); 1229 setTimeout(function(){ 1230 resizeVideoBackground(); 1231 $j('.video-wrap').animate({'opacity' : '1'}, 600); 1232 }, 600); 1233 1234 // Remove Video on mobile Devices 1235 if (/Android|BlackBerry|iPhone|iPad|iPod|webOS/i.test(navigator.userAgent) === true) { 1236 $j('.video-wrap').remove(); 1237 } 1238 1239 //fadeInItems(); 1240 //Scroll events 1241 $j(window).scroll(function() { 1242 if(!isMobile.any()){ 1243 stickyHeader(); 1244 } 1245 singlePageNavScroll(); 1246 scrollToTopButton(); 1247 //fadeInItems(); 1248 }); 1249 $j(window).bind('resize', function(e) { 1250 window.resizeEvt; 1251 $j(window).resize(function() { 1252 clearTimeout(window.resizeEvt); 1253 resizeVideoBackground(); 1254 window.resizeEvt = setTimeout(function() { 1255 windowWidth = window.innerWidth || document.documentElement.clientWidth; 1256 shapeDivider(); 1257 makeHeaderMobileFriendly(); 1258 initPortfolio(); 1259 megamenuWidth(); 1260 $j('.weston-carousel').data('owl.carousel'); 1261 }, 250); 1262 }); 1263 }); 1264}); 1265 1266$j(window).load(function() { 1267 windowWidth = window.innerWidth || document.documentElement.clientWidth; 1268 initMasonryBlog(); 1269 initCarousel() 1270 initPortfolio(); 1271 initLightbox(); 1272 stickyHeader(); 1273 shapeDivider(); 1274 init3DHover(); 1275 revealFooter(); 1276 if (!isMobile.any() && !isIE()) { 1277 initParallax(); 1278 } 1279 if (isIE() || isEdge()) { 1280 ieParallax(); 1281 } 1282 singlePageNavScroll(); 1283})
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.