1(function($){ 2 "use strict"; // Start of use strict 3 4 5 /* --------------------------------------------- 6 Scripts initialization 7 --------------------------------------------- */ 8 9 $(window).load(function(){ 10 11 // Page loader 12 13 $("body").imagesLoaded(function(){ 14 $(".page-loader div").fadeOut(); 15 $(".page-loader").delay(200).fadeOut("slow"); 16 }); 17 18 19 initWorkFilter(); 20 init_scroll_navigate(); 21 22 $(window).trigger("scroll"); 23 $(window).trigger("resize"); 24 25 // Hash menu forwarding 26 if ((window.location.hash) && ($(window.location.hash).length)){ 27 var hash_offset = $(window.location.hash).offset().top; 28 $("html, body").animate({ 29 scrollTop: hash_offset 30 }); 31 } 32 33 }); 34 35 $(document).ready(function(){ 36 37 $(window).trigger("resize"); 38 init_classic_menu(); 39 init_fullscreen_menu(); 40 init_side_panel(); 41 init_lightbox(); 42 init_parallax(); 43 init_shortcodes(); 44 init_tooltips(); 45 init_counters(); 46 init_team(); 47 initPageSliders(); 48 init_map(); 49 init_wow(); 50 init_masonry(); 51 }); 52 53 $(window).resize(function(){ 54 55 init_classic_menu_resize(); 56 init_side_panel_resize() 57 js_height_init(); 58 split_height_init(); 59 60 }); 61 62 63 /* -------------------------------------------- 64 Platform detect 65 --------------------------------------------- */ 66 var mobileTest; 67 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) { 68 mobileTest = true; 69 $("html").addClass("mobile"); 70 } 71 else { 72 mobileTest = false; 73 $("html").addClass("no-mobile"); 74 } 75 76 var mozillaTest; 77 if (/mozilla/.test(navigator.userAgent)) { 78 mozillaTest = true; 79 } 80 else { 81 mozillaTest = false; 82 } 83 var safariTest; 84 if (/safari/.test(navigator.userAgent)) { 85 safariTest = true; 86 } 87 else { 88 safariTest = false; 89 } 90 91 // Detect touch devices 92 if (!("ontouchstart" in document.documentElement)) { 93 document.documentElement.className += " no-touch"; 94 } 95 96 97 /* --------------------------------------------- 98 Sections helpers 99 --------------------------------------------- */ 100 101 // Sections backgrounds 102 103 var pageSection = $(".home-section, .page-section, .small-section, .split-section"); 104 pageSection.each(function(indx){ 105 106 if ($(this).attr("data-background")){ 107 $(this).css("background-image", "url(" + $(this).data("background") + ")"); 108 } 109 }); 110 111 // Function for block height 100% 112 function height_line(height_object, height_donor){ 113 height_object.height(height_donor.height()); 114 height_object.css({ 115 "line-height": height_donor.height() + "px" 116 }); 117 } 118 119 // Function equal height 120 !function(a){ 121 a.fn.equalHeights = function(){ 122 var b = 0, c = a(this); 123 return c.each(function(){ 124 var c = a(this).innerHeight(); 125 c > b && (b = c) 126 }), c.css("height", b) 127 }, a("[data-equal]").each(function(){ 128 var b = a(this), c = b.data("equal"); 129 b.find(c).equalHeights() 130 }) 131 }(jQuery); 132 133 134 // Progress bars 135 var progressBar = $(".progress-bar"); 136 progressBar.each(function(indx){ 137 $(this).css("width", $(this).attr("aria-valuenow") + "%"); 138 }); 139 140 141 142 /* --------------------------------------------- 143 Nav panel classic 144 --------------------------------------------- */ 145 146 var mobile_nav = $(".mobile-nav"); 147 var desktop_nav = $(".desktop-nav"); 148 149 function init_classic_menu_resize(){ 150 151 // Mobile menu max height 152 $(".mobile-on .desktop-nav >
152 ul").css("max-height", $(window).height() - $(".main-nav").height() - 20 + "px"); 153 154 // Mobile menu style toggle 155 if ($(window).width() <= 1024) { 156 $(".main-nav").addClass("mobile-on"); 157 } 158 else 159 if ($(window).width() > 1024) { 160 $(".main-nav").removeClass("mobile-on"); 161 desktop_nav.show(); 162 } 163 } 164 165 function init_classic_menu(){ 166 167 168 // Navbar sticky 169 170 $(".js-stick").sticky({ 171 topSpacing: 0 172 }); 173 174 175 height_line($(".inner-nav > ul > li > a"), $(".main-nav")); 176 height_line(mobile_nav, $(".main-nav")); 177 178 mobile_nav.css({ 179 "width": $(".main-nav").height() + "px" 180 }); 181 182 // Transpaner menu 183 184 if ($(".main-nav").hasClass("transparent")){ 185 $(".main-nav").addClass("js-transparent"); 186 } 187 188 $(window).scroll(function(){ 189 190 if ($(window).scrollTop() > 10) { 191 $(".js-transparent").removeClass("transparent"); 192 $(".main-nav, .nav-logo-wrap .logo, .mobile-nav").addClass("small-height"); 193 } 194 else { 195 $(".js-transparent").addClass("transparent"); 196 $(".main-nav, .nav-logo-wrap .logo, .mobile-nav").removeClass("small-height"); 197 } 198 199 200 }); 201 202 // Mobile menu toggle 203 204 mobile_nav.click(function(){ 205 206 if (desktop_nav.hasClass("js-opened")) { 207 desktop_nav.slideUp("slow", "easeOutExpo").removeClass("js-opened"); 208 $(this).removeClass("active"); 209 } 210 else { 211 desktop_nav.slideDown("slow", "easeOutQuart").addClass("js-opened"); 212 $(this).addClass("active"); 213 214 // Fix for responsive menu 215 if ($(".main-nav").hasClass("not-top")){ 216 $(window).scrollTo(".main-nav", "slow"); 217 } 218 219 } 220 221 }); 222 223 desktop_nav.find("a:not(.mn-has-sub)").click(function(){ 224 if (mobile_nav.hasClass("active")) { 225 desktop_nav.slideUp("slow", "easeOutExpo").removeClass("js-opened"); 226 mobile_nav.removeClass("active"); 227 } 228 }); 229 230 231 // Sub menu 232 233 var mnHasSub = $(".mn-has-sub"); 234 var mnThisLi; 235 236 $(".mobile-on .mn-has-sub").find(".fa:first").removeClass("fa-angle-right").addClass("fa-angle-down"); 237 238 mnHasSub.click(function(){ 239 240 if ($(".main-nav").hasClass("mobile-on")) { 241 mnThisLi = $(this).parent("li:first"); 242 if (mnThisLi.hasClass("js-opened")) { 243 mnThisLi.find(".mn-sub:first").slideUp(function(){ 244 mnThisLi.removeClass("js-opened"); 245 mnThisLi.find(".mn-has-sub").find(".fa:first").removeClass("fa-angle-up").addClass("fa-angle-down"); 246 }); 247 } 248 else { 249 $(this).find(".fa:first").removeClass("fa-angle-down").addClass("fa-angle-up"); 250 mnThisLi.addClass("js-opened"); 251 mnThisLi.find(".mn-sub:first").slideDown(); 252 } 253 254 return false; 255 } 256 else { 257 258 } 259 260 }); 261 262 mnThisLi = mnHasSub.parent("li"); 263 mnThisLi.hover(function(){ 264 265 if (!($(".main-nav").hasClass("mobile-on"))) { 266 267 $(this).find(".mn-sub:first").stop(true, true).fadeIn("fast"); 268 } 269 270 }, function(){ 271 272 if (!($(".main-nav").hasClass("mobile-on"))) { 273 274 $(this).find(".mn-sub:first").stop(true, true).delay(100).fadeOut("fast"); 275 } 276 277 }); 278 279 /* Keyboard navigation for main menu */ 280 281 $(".inner-nav a").focus(function(){ 282 if (!($(".main-nav").hasClass("mobile-on"))) { 283 $(this).parent("li").parent().children().find(".mn-sub:first").stop(true, true).delay(100).fadeOut("fast"); 284 } 285 }); 286 287 $(".inner-nav a").first().keydown(function(e){
288 if (!($(".main-nav").hasClass("mobile-on"))) { 289 if (e.shiftKey && e.keyCode == 9) { 290 $(this).parent("li").find(".mn-sub:first").stop(true, true).delay(100).fadeOut("fast"); 291 } 292 } 293 }); 294 295 $(".mn-sub li:last a").keydown(function(e){ 296 if (!($(".main-nav").hasClass("mobile-on"))) { 297 if (!e.shiftKey && e.keyCode == 9) { 298 $(this).parent("li").parent().stop(true, true).delay(100).fadeOut("fast"); 299 } 300 } 301 }); 302 303 $(document).keydown(function(e){ 304 if (!($(".main-nav").hasClass("mobile-on"))) { 305 if (e.keyCode == 27) { 306 if (mnHasSub.parent("li").find(".mn-sub:first li .mn-sub").is(":visible")){ 307 mnHasSub.parent("li").find(".mn-sub:first li .mn-sub").stop(true, true).delay(100).fadeOut("fast"); 308 } else{ 309 mnHasSub.parent("li").find(".mn-sub:first").stop(true, true).delay(100).fadeOut("fast"); 310 } 311 312 } 313 } 314 }); 315 316 mnHasSub.focus(function(){ 317 if (!($(".main-nav").hasClass("mobile-on"))) { 318 $(this).parent("li").find(".mn-sub:first").stop(true, true).fadeIn("fast"); 319 } 320 }); 321 322 } 323 324 325 326 /* --------------------------------------------- 327 Scroll navigation 328 --------------------------------------------- */ 329 330 function init_scroll_navigate(){ 331 332 $(".local-scroll").localScroll({ 333 target: "body", 334 duration: 1500, 335 offset: 0, 336 easing: "easeInOutExpo" 337 }); 338 339 var sections = $(".home-section, .split-section, .page-section"); 340 var menu_links = $(".scroll-nav li a"); 341 342 $(window).scroll(function(){ 343 344 sections.filter(":in-viewport:first").each(function(){ 345 var active_section = $(this); 346 var active_link = $('.scroll-nav li a[href="#' + active_section.attr("id") + '"]'); 347 menu_links.removeClass("active"); 348 active_link.addClass("active"); 349 }); 350 351 }); 352 353 } 354 355 356 357 /* --------------------------------------------- 358 Lightboxes 359 --------------------------------------------- */ 360 361 function init_lightbox(){ 362 363 // Works Item Lightbox 364 $(".work-lightbox-link").magnificPopup({ 365 gallery: { 366 enabled: true 367 }, 368 mainClass: "mfp-fade" 369 }); 370 371 // Works Item Lightbox 372 $(".lightbox-gallery-1").magnificPopup({ 373 gallery: { 374 enabled: true 375 } 376 }); 377 378 // Other Custom Lightbox 379 $(".lightbox-gallery-2").magnificPopup({ 380 gallery: { 381 enabled: true 382 } 383 }); 384 $(".lightbox-gallery-3").magnificPopup({ 385 gallery: { 386 enabled: true 387 } 388 }); 389 $(".lightbox").magnificPopup(); 390 391 } 392 393 394 395 /* ------------------------------------------- 396 Parallax 397 --------------------------------------------- */ 398 399 function init_parallax(){ 400 401 // Parallax 402 if (($(window).width() >= 1024) && (mobileTest == false)) { 403 $(".parallax-1").parallax("50%", 0.1); 404 $(".parallax-2").parallax("50%", 0.2); 405 $(".parallax-3").parallax("50%", 0.3); 406 $(".parallax-4").parallax("50%", 0.4); 407 $(".parallax-5").parallax("50%", 0.5); 408 $(".parallax-6").parallax("50%", 0.6); 409 $(".parallax-7").parallax("50%", 0.7); 410 $(".parallax-8").parallax("50%", 0.5); 411 $(".parallax-9").parallax("50%", 0.5); 412 $(".parallax-10").parallax("50%", 0.5); 413 $(".parallax-11").parallax("50%", 0.05); 414 } 415 416 } 417 418 419 420 /* --------------------------------------------- 421 Shortcodes 422 --------------------------------------------- */ 423 // Tabs minimal 424 function init_shortcodes(){ 425 426 var tpl_tab_height; 427 $(".tpl-minimal-tabs > li > a").click(function(){ 428 429 if (!($(this).parent("li").hasClass("active"))) { 430 tpl_tab_height = $(".tpl-minimal-tabs-cont > .tab-pane").filter($(this).attr("href")).height(); 431 $(".tpl-minimal-tabs-cont").animate({ 432 height: tpl_tab_height 433 }, function(){ 434 $(".tpl-minimal-tabs-cont").css("height", "auto"); 435 }); 436 437 } 438 439 }); 440 441 // Accordion 442 $(".accordion").each(function(){ 443 var allPanels = $(this).children("dd").hide(); 444 $(this).children("dd").first().slideDown("easeOutExpo"); 445 $(this).children("dt").children("a").first().addClass("active"); 446 447 $(this).children("dt").children("a").click(function(){ 448 var current = $(this).parent().next("dd"); 449 $(".accordion > dt > a").removeClass("active"); 450 $(this).addClass("active");
451 allPanels.not(current).slideUp("easeInExpo"); 452 $(this).parent().next().slideDown("easeOutExpo"); 453 return false; 454 }); 455 456 }); 457 458 459 460 // Toggle 461 var allToggles = $(".toggle > dd").hide(); 462 463 $(".toggle > dt > a").click(function(){ 464 465 if ($(this).hasClass("active")) { 466 467 $(this).parent().next().slideUp("easeOutExpo"); 468 $(this).removeClass("active"); 469 470 } 471 else { 472 var current = $(this).parent().next("dd"); 473 $(this).addClass("active"); 474 $(this).parent().next().slideDown("easeOutExpo"); 475 } 476 477 return false; 478 }); 479 480 // Responsive video 481 $(".video, .resp-media, .blog-media").fitVids(); 482 $(".work-full-media").fitVids(); 483 484 } 485 486 487 488 /* --------------------------------------------- 489 Tooltips (bootstrap plugin activated) 490 --------------------------------------------- */ 491 492 function init_tooltips(){ 493 494 $(".tooltip-bot, .tooltip-bot a, .nav-social-links a").tooltip({ 495 placement: "bottom" 496 }); 497 498 $(".tooltip-top, .tooltip-top a").tooltip({ 499 placement: "top" 500 }); 501 502 } 503 504 505 506 /* --------------------------------------------- 507 Some facts section 508 --------------------------------------------- */ 509 510 function init_counters(){ 511 $(".count-number").appear(function(){ 512 var count = $(this); 513 count.countTo({ 514 from: 0, 515 to: count.html(), 516 speed: 1300, 517 refreshInterval: 60, 518 }); 519 520 }); 521 } 522 523 524 525 526 /* --------------------------------------------- 527 Team 528 --------------------------------------------- */ 529 530 function init_team(){ 531 532 // Hover 533 $(".team-item").click(function(){ 534 if ($("html").hasClass("mobile")) { 535 $(this).toggleClass("js-active"); 536 } 537 }); 538 539 // Keayboar navigation for team section 540 $(".team-social-links > a").on("focus blur", function(){ 541 if (!($("html").hasClass("mobile"))) { 542 $(this).parent().parent().parent().parent().toggleClass("js-active"); 543 } 544 }); 545 546 } 547 548 549})(jQuery); // End of use strict 550 551 552/* --------------------------------------------- 553 Sliders 554 --------------------------------------------- */ 555function initPageSliders(){ 556 (function($){ 557 "use strict"; 558 559 // Fullwidth slider 560 $(".fullwidth-slider").owlCarousel({ 561 slideSpeed: 350, 562 singleItem: true, 563 autoHeight: true, 564 navigation: true, 565 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 566 }); 567 568 // Fullwidth slider 569 $(".fullwidth-slider-fade").owlCarousel({ 570 transitionStyle: "fadeUp", 571 slideSpeed: 350, 572 singleItem: true, 573 autoHeight: true, 574 navigation: true, 575 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 576 }); 577 578 // Fullwidth gallery 579 $(".fullwidth-gallery").owlCarousel({ 580 transitionStyle: "fade", 581 autoPlay: 5000, 582 slideSpeed: 700, 583 singleItem: true, 584 autoHeight: true, 585 navigation: false, 586 pagination: false 587 }); 588 589 // Item carousel 590 $(".item-carousel").owlCarousel({ 591 autoPlay: 2500, 592 //stopOnHover: true, 593 items: 3, 594 itemsDesktop: [1199, 3], 595 itemsTabletSmall: [768, 3], 596 itemsMobile: [480, 1], 597 navigation: false, 598 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 599 }); 600 601 // Item carousel 602 $(".small-item-carousel").owlCarousel({ 603 autoPlay: 2500, 604 stopOnHover: true, 605 items: 6, 606 itemsDesktop: [1199, 4], 607 itemsTabletSmall: [768, 3], 608 itemsMobile: [480, 2], 609 pagination: false, 610 navigation: false, 611 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 612 }); 613 614 // Single carousel 615 $(".single-carousel").owlCarousel({ 616 singleItem: true, 617 autoHeight: true, 618 navigation: true, 619 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 620 }); 621 622 // Content Slider 623 $(".content-slider").owlCarousel({ 624 slideSpeed: 350, 625 singleItem: true, 626 autoHeight: true, 627 navigation: true, 628 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 629 }); 630 631 // Photo slider 632 $(".photo-slider").owlCarousel({ 633 slideSpeed: 350, 634 items: 4, 635 itemsDesktop: [1199, 4], 636 itemsTabletSmall: [768, 2], 637 itemsMobile: [480, 1], 638 autoHeight: true, 639 navigation: true, 640 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 641 }); 642 643 // Work slider 644 $(".work-full-slider").owlCarousel({ 645 slideSpeed : 350, 646 singleItem: true, 647 autoHeight: true, 648 navigation: true, 649 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 650 }); 651 652 // Blog posts carousel 653 $(".blog-posts-carousel").owlCarousel({ 654 autoPlay: 5000, 655 stopOnHover: true, 656 items: 3, 657 itemsDesktop: [1199, 3], 658 itemsTabletSmall: [768, 2], 659 itemsMobile: [480, 1], 660 pagination: false, 661 navigation: true, 662 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 663 }); 664 665 // Blog posts carousel alt 666 $(".blog-posts-carousel-alt").owlCarousel({ 667 autoPlay: 3500, 668 stopOnHover: true, 669 slideSpeed: 350, 670 singleItem: true, 671 autoHeight: true, 672 pagination: false, 673 navigation: true, 674 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 675 }); 676 677 // Image carousel 678 $(".image-carousel").owlCarousel({ 679 autoPlay: 5000, 680 stopOnHover: true, 681 items: 4, 682 itemsDesktop: [1199, 3], 683 itemsTabletSmall: [768, 2], 684 itemsMobile: [480, 1], 685 navigation: true, 686 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"] 687 }); 688 689 // Fullwidth slideshow 690 691 var sync1 = $(".fullwidth-slideshow"); 692 var sync2 = $(".fullwidth-slideshow-pager"); 693 694 $(".fullwidth-slideshow").owlCarousel({ 695 autoPlay: 5000, 696 stopOnHover: true, 697 transitionStyle: "fade", 698 slideSpeed: 350, 699 singleItem: true, 700 autoHeight: true, 701 pagination: false, 702 navigation: true, 703 navigationText: ["<i class='fa fa-angle-left'></i>", "<i class='fa fa-angle-right'></i>"], 704 afterAction : syncPosition, 705 responsiveRefreshRate : 200 706 }); 707 $(".fullwidth-slideshow-pager").owlCarousel({ 708 autoPlay: 5000, 709 stopOnHover: true, 710 items: 8, 711 itemsDesktop: [1199,8], 712 itemsDesktopSmall: [979,7], 713 itemsTablet: [768,6], 714 itemsMobile: [480,4], 715 autoHeight: true, 716 pagination: false, 717 navigation: false, 718 responsiveRefreshRate : 100, 719 afterInit : function(el){ 720 el.find(".owl-item").eq(0).addClass("synced"); 721 } 722 }); 723 724 function syncPosition(el){ 725 var current = this.currentItem; 726 $(".fullwidth-slideshow-pager").find(".owl-item").removeClass("synced").eq(current).addClass("synced") 727 if ($(".fullwidth-slideshow-pager").data("owlCarousel") !== undefined) { 728 center(current) 729 } 730 } 731 732 $(".fullwidth-slideshow-pager").on("click", ".owl-item", function(e){
733 e.preventDefault(); 734 var number = $(this).data("owlItem"); 735 sync1.trigger("owl.goTo", number); 736 }); 737 738 function center(number){ 739 var sync2visible = sync2.data("owlCarousel").owl.visibleItems; 740 var num = number; 741 var found = false; 742 for (var i in sync2visible) { 743 if (num === sync2visible[i]) { 744 var found = true; 745 } 746 } 747 if (found === false) { 748 if (num > sync2visible[sync2visible.length - 1]) { 749 sync2.trigger("owl.goTo", num - sync2visible.length + 2) 750 } 751 else { 752 if (num - 1 === -1) { 753 num = 0; 754 } 755 sync2.trigger("owl.goTo", num); 756 } 757 } 758 else 759 if (num === sync2visible[sync2visible.length - 1]) { 760 sync2.trigger("owl.goTo", sync2visible[1]) 761 } 762 else 763 if (num === sync2visible[0]) { 764 sync2.trigger("owl.goTo", num - 1) 765 } 766 } 767 768 var owl = $(".fullwidth-slideshow").data("owlCarousel"); 769 770 $(document.documentElement).keyup(function(event){ 771 // handle cursor keys 772 if (event.keyCode == 37) { 773 owl.prev(); 774 } 775 else 776 if (event.keyCode == 39) { 777 owl.next(); 778 } 779 }); 780 781 if ($(".owl-carousel").length) { 782 var owl = $(".owl-carousel").data('owlCarousel'); 783 owl.reinit(); 784 } 785 786 })(jQuery); 787}; 788 789 790/* --------------------------------------------- 791 Fullscreen menu 792 --------------------------------------------- */ 793 794 var fm_menu_wrap = $("#fullscreen-menu"); 795 var fm_menu_button = $(".fm-button"); 796 797 function init_fullscreen_menu(){ 798 799 fm_menu_button.click(function(){ 800 801 if ($(this).hasClass("animation-process")){ 802 return false; 803 } 804 else{ 805 if ($(this).hasClass("active")) { 806 $(this).removeClass("active").css("z-index", "2001").addClass("animation-process");; 807 808 fm_menu_wrap.find(".fm-wrapper-sub").fadeOut("fast", function(){ 809 fm_menu_wrap.fadeOut(function(){ 810 fm_menu_wrap.find(".fm-wrapper-sub").removeClass("js-active").show(); 811 fm_menu_button.css("z-index", "1030").removeClass("animation-process"); 812 813 }); 814 }); 815 816 if ($(".owl-carousel").lenth) { 817 $(".owl-carousel").data("owlCarousel").play(); 818 } 819 820 } 821 else { 822 if ($(".owl-carousel").lenth) { 823 $(".owl-carousel").data("owlCarousel").stop(); 824 } 825 $(this).addClass("active").css("z-index", "2001").addClass("animation-process"); 826 827 fm_menu_wrap.fadeIn(function(){ 828 fm_menu_wrap.find(".fm-wrapper-sub").addClass("js-active"); 829 fm_menu_button.removeClass("animation-process"); 830 }); 831 } 832 833 return false; 834 } 835 836 }); 837 838 $("#fullscreen-menu").find("a:not(.fm-has-sub)").click(function(){ 839 840 if (fm_menu_button.hasClass("animation-process")){ 841 return false; 842 } 843 else { 844 fm_menu_button.removeClass("active").css("z-index", "2001").addClass("animation-process"); 845 846 fm_menu_wrap.find(".fm-wrapper-sub").fadeOut("fast", function(){ 847 fm_menu_wrap.fadeOut(function(){ 848 fm_menu_wrap.find(".fm-wrapper-sub").removeClass("js-active").show(); 849 fm_menu_button.css("z-index", "1030").removeClass("animation-process"); 850 851 }); 852 }); 853 854 if ($(".owl-carousel").lenth) { 855 $(".owl-carousel").data("owlCarousel").play(); 856 } 857 } 858 }); 859 860 // Sub menu 861 862 var fmHasSub = $(".fm-has-sub"); 863 var fmThisLi; 864 865 fmHasSub.click(function(){ 866 867 fmThisLi = $(this).parent("li:first"); 868 if (fmThisLi.hasClass("js-opened")) { 869 fmThisLi.find(".fm-sub:first").slideUp(function(){ 870 fmThisLi.removeClass("js-opened"); 871 fmThisLi.find(".fm-has-sub").find(".fa:first").removeClass("fa-angle-up").addClass("fa-angle-down"); 872 }); 873 } 874 else { 875 $(this).find(".fa:first").removeClass("fa-angle-down").addClass("fa-angle-up"); 876 fmThisLi.addClass("js-opened"); 877 fmThisLi.find(".fm-sub:first").slideDown(); 878 } 879 880 return false; 881 882 }); 883 884 } 885 886 887/* --------------------------------------------- 888 Side panel 889 --------------------------------------------- */ 890 891 var side_panel = $(".side-panel"); 892 var sp_button = $(".sp-button"); 893 var sp_close_button = $(".sp-close-button");
894 var sp_overlay = $(".sp-overlay"); 895 896 function sp_panel_close(){ 897 side_panel.animate({ 898 opacity: 0, 899 left: -270 900 }, 500, "easeOutExpo"); 901 sp_overlay.fadeOut(); 902 903 904 if ($(".owl-carousel").lenth) { 905 $(".owl-carousel").data("owlCarousel").play(); 906 } 907 } 908 909 function init_side_panel(){ 910 (function($){ 911 "use strict"; 912 913 sp_button.click(function(){ 914 915 side_panel.animate({ 916 opacity: 1, 917 left: 0 918 }, 500, "easeOutExpo"); 919 920 setTimeout(function(){ 921 sp_overlay.fadeIn(); 922 }, 100); 923 924 if ($(".owl-carousel").lenth) { 925 $(".owl-carousel").data("owlCarousel").stop(); 926 } 927 928 return false; 929 930 }); 931 932 sp_close_button.click(function(){ 933 sp_panel_close(); 934 return false; 935 }); 936 sp_overlay.click(function(){ 937 sp_panel_close(); 938 return false; 939 }); 940 941 $("#side-panel-menu").find("a:not(.sp-has-sub)").click(function(){ 942 if (!($(window).width() >= 1199)) { 943 sp_panel_close(); 944 } 945 }); 946 947 948 // Sub menu 949 950 var spHasSub = $(".sp-has-sub"); 951 var spThisLi; 952 953 spHasSub.click(function(){ 954 955 spThisLi = $(this).parent("li:first"); 956 if (spThisLi.hasClass("js-opened")) { 957 spThisLi.find(".sp-sub:first").slideUp(function(){ 958 spThisLi.removeClass("js-opened"); 959 spThisLi.find(".sp-has-sub").find(".fa:first").removeClass("fa-angle-up").addClass("fa-angle-down"); 960 }); 961 } 962 else { 963 $(this).find(".fa:first").removeClass("fa-angle-down").addClass("fa-angle-up"); 964 spThisLi.addClass("js-opened"); 965 spThisLi.find(".sp-sub:first").slideDown(); 966 } 967 968 return false; 969 970 }); 971 972 })(jQuery); 973 } 974 975 function init_side_panel_resize(){ 976 (function($){ 977 "use strict"; 978 979 if ($(window).width() >= 1199){ 980 side_panel.css({ 981 opacity: 1, 982 left: 0 983 }); 984 $(".side-panel-is-left").css("margin-left", "270px"); 985 sp_button.css("display", "none"); 986 sp_close_button.css("display", "none"); 987 } else { 988 if (sp_close_button.is(":hidden")) { 989 side_panel.css({ 990 opacity: 0, 991 left: -270 992 }); 993 $(".side-panel-is-left").css("margin-left", "0"); 994 sp_button.css("display", "block"); 995 sp_close_button.css("display", "block"); 996 } 997 } 998 999 })(jQuery); 1000 } 1001 1002/* --------------------------------------------- 1003 Portfolio section 1004 --------------------------------------------- */ 1005 1006// Projects filtering 1007var fselector = 0; 1008var work_grid = $("#work-grid, #isotope"); 1009 1010function initWorkFilter(){ 1011 (function($){ 1012 "use strict"; 1013 var isotope_mode; 1014 if (work_grid.hasClass("masonry")){ 1015 isotope_mode = "masonry"; 1016 } else{ 1017 isotope_mode = "fitRows" 1018 } 1019 1020 $(".filter").click(function(){ 1021 $(".filter").removeClass("active"); 1022 $(this).addClass("active"); 1023 fselector = $(this).attr('data-filter'); 1024 1025 work_grid.imagesLoaded(function(){ 1026 work_grid.isotope({ 1027 itemSelector: '.mix', 1028 layoutMode: isotope_mode, 1029 filter: fselector 1030 }); 1031 }); 1032 return false; 1033 }); 1034 1035 if (window.location.hash) { 1036 $(".filter").each(function(){ 1037 if ($(this).attr("data-filter") == "." + window.location.hash.replace("#", "")) { 1038 $(this).trigger('click'); 1039 1040 $("html, body").animate({ 1041 scrollTop: $("#portfolio").offset().top 1042 }); 1043 1044 } 1045 }); 1046 } 1047 1048 work_grid.imagesLoaded(function(){ 1049 work_grid.isotope({ 1050 itemSelector: '.mix', 1051 layoutMode: isotope_mode, 1052 filter: fselector 1053 }); 1054 }); 1055 1056 1057 })(jQuery); 1058} 1059 1060 1061 1062 1063 1064/* --------------------------------------------- 1065 Height 100% 1066 --------------------------------------------- */ 1067function js_height_init(){ 1068 (function($){ 1069 $(".js-height-full").height($(window).height()); 1070 $(".js-height-parent").each(function(){ 1071 $(this).height($(this).parent().first().height()); 1072 }); 1073 })(jQuery); 1074} 1075 1076 1077 1078 1079/* --------------------------------------------- 1080 Google map 1081 --------------------------------------------- */ 1082 1083var gmMapDiv = $("#map-canvas"); 1084 1085function init_map(){ 1086 (function($){ 1087 1088 $(".map-section").click(function(){ 1089 $(this).toggleClass("js-active"); 1090 $(this).find(".mt-open").toggle(); 1091 $(this).find(".mt-close").toggle(); 1092 return false; 1093 }); 1094 1095 })(jQuery); 1096} 1097 1098 1099 1100 1101/* --------------------------------------------- 1102 WOW animations 1103 --------------------------------------------- */ 1104 1105function init_wow(){ 1106 (function($){ 1107 1108 var wow = new WOW({ 1109 boxClass: 'wow', 1110 animateClass: 'animated', 1111 offset: 90, 1112 mobile: false, 1113 live: true 1114 }); 1115 1116 if ($("body").hasClass("appear-animate")){ 1117 wow.init(); 1118 } 1119 1120 })(jQuery); 1121} 1122 1123 1124/* --------------------------------------------- 1125 Masonry 1126 --------------------------------------------- */ 1127 1128function init_masonry(){ 1129 (function($){ 1130 1131 $(".masonry").imagesLoaded(function(){ 1132 $(".masonry").masonry(); 1133 }); 1134 1135 })(jQuery); 1136} 1137 1138 1139/* --------------------------------------------- 1140 Split section 1141 --------------------------------------------- */ 1142 1143function split_height_init(){ 1144 (function($){ 1145 1146 $(".ssh-table, .split-section-content").css("height", "auto"); 1147 1148 if ($(window).width() > 992) { 1149 $(".split-section").each(function(){ 1150 var split_section_height = $(this).find(".split-section-content").innerHeight(); 1151 $(this).find(".ssh-table").height(split_section_height); 1152 }); 1153 } 1154 1155 })(jQuery); 1156} 1157 1158 1159/* --------------------------------------------- 1160 Polyfill for :focus-visible 1161 --------------------------------------------- */ 1162 1163/** 1164 * https://github.com/WICG/focus-visible 1165 */
1166function init() { 1167 var hadKeyboardEvent = true; 1168 var hadFocusVisibleRecently = false; 1169 var hadFocusVisibleRecentlyTimeout = null; 1170 1171 var inputTypesWhitelist = { 1172 text: true, 1173 search: true, 1174 url: true, 1175 tel: true, 1176 email: true, 1177 password: true, 1178 number: true, 1179 date: true, 1180 month: true, 1181 week: true, 1182 time: true, 1183 datetime: true, 1184 'datetime-local': true 1185 }; 1186 1187 /** 1188 * Helper function for legacy browsers and iframes which sometimes focus 1189 * elements like document, body, and non-interactive SVG. 1190 * @param {Element} el 1191 */ 1192 function isValidFocusTarget(el) { 1193 if ( 1194 el && 1195 el !== document && 1196 el.nodeName !== 'HTML' && 1197 el.nodeName !== 'BODY' && 1198 'classList' in el && 1199 'contains' in el.classList 1200 ) { 1201 return true; 1202 } 1203 return false; 1204 } 1205 1206 /** 1207 * Computes whether the given element should automatically trigger the 1208 * `focus-visible` class being added, i.e. whether it should always match 1209 * `:focus-visible` when focused. 1210 * @param {Element} el 1211 * @return {boolean} 1212 */ 1213 function focusTriggersKeyboardModality(el) { 1214 var type = el.type; 1215 var tagName = el.tagName; 1216 1217 if (tagName == 'INPUT' && inputTypesWhitelist[type] && !el.readOnly) { 1218 return true; 1219 } 1220 1221 if (tagName == 'TEXTAREA' && !el.readOnly) { 1222 return true; 1223 } 1224 1225 if (el.isContentEditable) { 1226 return true; 1227 } 1228 1229 return false; 1230 } 1231 1232 /** 1233 * Add the `focus-visible` class to the given element if it was not added by 1234 * the author. 1235 * @param {Element} el 1236 */ 1237 function addFocusVisibleClass(el) { 1238 if (el.classList.contains('focus-visible')) { 1239 return; 1240 } 1241 el.classList.add('focus-visible'); 1242 el.setAttribute('data-focus-visible-added', ''); 1243 } 1244 1245 /** 1246 * Remove the `focus-visible` class from the given element if it was not 1247 * originally added by the author. 1248 * @param {Element} el 1249 */ 1250 function removeFocusVisibleClass(el) { 1251 if (!el.hasAttribute('data-focus-visible-added')) { 1252 return; 1253 } 1254 el.classList.remove('focus-visible'); 1255 el.removeAttribute('data-focus-visible-added'); 1256 } 1257 1258 /** 1259 * Treat `keydown` as a signal that the user is in keyboard modality. 1260 * Apply `focus-visible` to any current active element and keep track 1261 * of our keyboard modality state with `hadKeyboardEvent`. 1262 * @param {Event} e 1263 */ 1264 function onKeyDown(e) { 1265 if (isValidFocusTarget(document.activeElement)) { 1266 addFocusVisibleClass(document.activeElement); 1267 } 1268 1269 hadKeyboardEvent = true; 1270 } 1271 1272 /** 1273 * If at any point a user clicks with a pointing device, ensure that we change 1274 * the modality away from keyboard. 1275 * This avoids the situation where a user presses a key on an already focused 1276 * element, and then clicks on a different element, focusing it with a 1277 * pointing device, while we still think we're in keyboard modality. 1278 * @param {Event} e 1279 */ 1280 function onPointerDown(e) { 1281 hadKeyboardEvent = false; 1282 } 1283 1284 /** 1285 * On `focus`, add the `focus-visible` class to the target if: 1286 * - the target received focus as a result of keyboard navigation, or 1287 * - the event target is an element that will likely require interaction 1288 * via the keyboard (e.g. a text box) 1289 * @param {Event} e 1290 */ 1291 function onFocus(e) { 1292 // Prevent IE from focusing the document or HTML element. 1293 if (!isValidFocusTarget(e.target)) { 1294 return; 1295 } 1296 1297 if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) { 1298 addFocusVisibleClass(e.target); 1299 } 1300 } 1301 1302 /** 1303 * On `blur`, remove the `focus-visible` class from the target. 1304 * @param {Event} e 1305 */ 1306 function onBlur(e) { 1307 if (!isValidFocusTarget(e.target)) { 1308 return; 1309 } 1310 1311 if ( 1312 e.target.classList.contains('focus-visible') || 1313 e.target.hasAttribute('data-focus-visible-added') 1314 ) { 1315 // To detect a tab/window switch, we look for a blur event followed 1316 // rapidly by a visibility change. 1317 // If we don't see a visibility change within 100ms, it's probably a 1318 // regular focus change. 1319 hadFocusVisibleRecently = true; 1320 window.clearTimeout(hadFocusVisibleRecentlyTimeout); 1321 hadFocusVisibleRecentlyTimeout = window.setTimeout(function() { 1322 hadFocusVisibleRecently = false; 1323 window.clearTimeout(hadFocusVisibleRecentlyTimeout); 1324 }, 100); 1325 removeFocusVisibleClass(e.target); 1326 } 1327 } 1328 1329 /** 1330 * If the user changes tabs, keep track of whether or not the previously 1331 * focused element had .focus-visible. 1332 * @param {Event} e 1333 */ 1334 function onVisibilityChange(e) { 1335 if (document.visibilityState == 'hidden') { 1336 // If the tab becomes active again, the browser will handle calling focus 1337 // on the element (Safari actually calls it twice). 1338 // If this tab change caused a blur on an element with focus-visible, 1339 // re-apply the class when the user switches back to the tab. 1340 if (hadFocusVisibleRecently) { 1341 hadKeyboardEvent = true; 1342 } 1343 addInitialPointerMoveListeners(); 1344 } 1345 } 1346 1347 /** 1348 * Add a group of listeners to detect usage of any pointing devices. 1349 * These listeners will be added when the polyfill first loads, and anytime 1350 * the window is blurred, so that they are active when the window regains 1351 * focus. 1352 */ 1353 function addInitialPointerMoveListeners() { 1354 document.addEventListener('mousemove', onInitialPointerMove); 1355 document.addEventListener('mousedown', onInitialPointerMove); 1356 document.addEventListener('mouseup', onInitialPointerMove); 1357 document.addEventListener('pointermove', onInitialPointerMove); 1358 document.addEventListener('pointerdown', onInitialPointerMove); 1359 document.addEventListener('pointerup', onInitialPointerMove); 1360 document.addEventListener('touchmove', onInitialPointerMove); 1361 document.addEventListener('touchstart', onInitialPointerMove); 1362 document.addEventListener('touchend', onInitialPointerMove); 1363 } 1364 1365 function removeInitialPointerMoveListeners() { 1366 document.removeEventListener('mousemove', onInitialPointerMove); 1367 document.removeEventListener('mousedown', onInitialPointerMove); 1368 document.removeEventListener('mouseup', onInitialPointerMove); 1369 document.removeEventListener('pointermove', onInitialPointerMove); 1370 document.removeEventListener('pointerdown', onInitialPointerMove); 1371 document.removeEventListener('pointerup', onInitialPointerMove); 1372 document.removeEventListener('touchmove', onInitialPointerMove); 1373 document.removeEventListener('touchstart', onInitialPointerMove); 1374 document.removeEventListener('touchend', onInitialPointerMove); 1375 } 1376 1377 /** 1378 * When the polfyill first loads, assume the user is in keyboard modality. 1379 * If any event is received from a pointing device (e.g. mouse, pointer, 1380 * touch), turn off keyboard modality. 1381 * This accounts for situations where focus enters the page from the URL bar. 1382 * @param {Event} e 1383 */ 1384 function onInitialPointerMove(e) { 1385 // Work around a Safari quirk that fires a mousemove on <html> whenever the 1386 // window blurs, even if you're tabbing out of the page. ¯\_(ã)_/¯ 1387 if (e.target.nodeName.toLowerCase() === 'html') { 1388 return; 1389 } 1390 1391 hadKeyboardEvent = false; 1392 removeInitialPointerMoveListeners(); 1393 } 1394 1395 document.addEventListener('keydown', onKeyDown, true); 1396 document.addEventListener('mousedown', onPointerDown, true); 1397 document.addEventListener('pointerdown', onPointerDown, true); 1398 document.addEventListener('touchstart', onPointerDown, true); 1399 document.addEventListener('focus', onFocus, true); 1400 document.addEventListener('blur', onBlur, true); 1401 document.addEventListener('visibilitychange', onVisibilityChange, true); 1402 addInitialPointerMoveListeners(); 1403 1404 document.body.classList.add('js-focus-visible'); 1405} 1406 1407/** 1408 * Subscription when the DOM is ready 1409 * @param {Function} callback 1410 */ 1411function onDOMReady(callback) { 1412 var loaded; 1413 1414 /** 1415 * Callback wrapper for check loaded state 1416 */ 1417 function load() { 1418 if (!loaded) { 1419 loaded = true; 1420 1421 callback(); 1422 } 1423 } 1424 1425 if (['interactive', 'complete'].indexOf(document.readyState) >= 0) { 1426 callback(); 1427 } else { 1428 loaded = false; 1429 document.addEventListener('DOMContentLoaded', load, false); 1430 window.addEventListener('load', load, false); 1431 } 1432} 1433 1434if (typeof document !== 'undefined') { 1435 onDOMReady(init); 1436}
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.