1/*global jQuery, window, Modernizr, navigator, lang_home, objFlexSlider, objLayerSlider, objFlickr, jCarousel, objPostSlider, objGallerySlider, objTestimonials, objBlackAndWhite, google, objGoogleMap*/ 2 3(function ($, win, Modernizr, nav, doc) { 4 5 "use strict"; 6 7 $(function () { 8 9 /* ---------------------------------------------------- */ 10 /* Main Navigation */ 11 /* ---------------------------------------------------- */ 12 13 (function () { 14 15 var arrowimages = { 16 down: 'downarrowclass', 17 right: 'rightarrowclass' 18 }, $mainNav = $('#navigation'), $mainList = $mainNav.find('ul').eq(0), optionsList = '<option value="" selected>Navigate...</option>', $submenu = $mainList.find("ul").parent(); 19 20 $submenu.each(function (i) { 21 var $curobj = $(this); 22 this.istopheader = ($curobj.parents("ul").length === 1 ? true : false); 23 $curobj.children("a").append('<span class="' + (this.istopheader ? arrowimages.down : arrowimages.right) + '"></span>'); 24 }); 25 26 $mainList.on('mouseenter', 'li', function () { 27 var $this = $(this), 28 $subMenu = $this.children('ul'); 29 if ($subMenu.length) { 30 $this.addClass('hover'); 31 } 32 $subMenu.hide().stop(true, true).fadeIn(200); 33 }).on('mouseleave', 'li', function () { 34 $(this).removeClass('hover').children('ul').stop(true, true).fadeOut(50); 35 }); 36 37 // Responsive 38 $mainList.find('li').each(function () { 39 var $this = $(this), $anchor = $this.children('a'), depth = $this.parents('ul').length - 1, indent = ''; 40 if (depth) { 41 while (depth > 0) { 42 indent += '-'; 43 depth = depth - 1; 44 } 45 } 46 optionsList += '<option value="' + $anchor.attr('href') + '">' + indent + ' ' + $anchor.text() + '</option>'; 47 48 }); 49 50 $mainNav.after('<select class="responsive-nav">' + optionsList + '</select>'); 51 52 $('.responsive-nav').on('change', function () { 53 win.location = $(this).val(); 54 }); 55 56 $.fn.headerToFixed = function (options) { 57 58 var defaults = { 59 speed : 300, 60 windowWidth : $(win).width(), 61 scrollTop : $(win).scrollTop() 62 }, o = $.extend({}, defaults, options), $this = $(this), $clone = $('#logo').clone(), heightHeader = $this.height(); 63 64 if (o.windowWidth > 767) { 65 if (o.scrollTop > heightHeader) { 66 if (!$this.hasClass('fixed')) { 67 $this.find('.sixteen').prepend($clone); 68 $this.slideUp(o.speed).addClass('fixed').stop(true, true).slideDown(o.speed); 69 } 70 } else { 71 if ($this.hasClass('fixed')) { 72 $this.stop(true, true).slideUp(o.speed).stop(true, true).removeClass('fixed').slideDown(o.speed); 73 $this.find('.sixteen #logo').fadeOut(o.speed).remove(); 74 } 75 } 76 } 77 }; 78 79 if (objNavMenu.fixed) { 80 if (!Modernizr.touch) { 81 $(win).scroll(function () { 82 $('#header').headerToFixed(); 83 }); 84 } 85 } 86 87 }()); 88 89 /* end Main Navigation */ 90 91 /* ---------------------------------------------------- */ 92 /* Media Element */ 93 /* ---------------------------------------------------- */ 94 95 (function () { 96 97 var $player = $('audio, video'); 98 99 if ($player.length) { 100 101 $player.mediaelementplayer({ 102 audioWidth: '100%', 103 audioHeight: '30px', 104 videoWidth: '100%', 105 videoHeight: '100%' 106 }); 107 108 } 109 }()); 110 111 /* ---------------------------------------------------------------------- */ 112 /* Detect Touch Device */ 113 /* ---------------------------------------------------------------------- */ 114 115 (function () { 116 117 if (Modernizr.touch) { 118 $('body').addClass('touch-device'); 119 } 120 121 if ($.browser.safari === true) { 122 $('body').addClass('safari'); 123 } 124 125 }()); 126 127 /* end Detect Touch Device */ 128 129 /*--------------------------------------------------------------------*/ 130 /* Flex Slider */ 131 /*--------------------------------------------------------------------*/ 132 133 (function () { 134 135 var $flex = $('.flexslider'); 136 137 if ($flex.length) { 138 $(win).load(function () { 139 $flex.flexslider(objFlexSlider); 140 }); 141 } 142 143 }()); 144 145 /* end Flex Slider */ 146 147 /*--------------------------------------------------------------------*/ 148 /* Layer Slider */ 149 /*--------------------------------------------------------------------*/ 150 151 (function () { 152 153 var $layer = $('#layerslider'); 154 155 if ($layer.length) { 156 $layer.layerSlider(objLayerSlider); 157 } 158 159 }()); 160 161 /* end Layer Slider */ 162 163 /* ---------------------------------------------------- */ 164 /* Flickr */ 165 /* ---------------------------------------------------- */ 166 167 (function () { 168 169 if ($('.flickr-badge').length) { 170 171 var $flickr = $('.flickr-badge'); 172 $flickr.jflickrfeed(objFlickr, function () { 173 174 var $bwWrapper = jQuery('.badge'); 175 176 if (Modernizr.touch) { 177 178 $(win).load(function () { 179 $bwWrapper.BlackAndWhite(objBlackAndWhiteTouch); 180 }); 181 182 } else { 183 184 $(win).load(function () { 185 $bwWrapper.BlackAndWhite(objBlackAndWhite); 186 }); 187 188 } 189 }); 190 } 191 192 }()); 193 194 /* end Flickr */ 195 196 /* ---------------------------------------------------- */ 197 /* Tabs */ 198 /* ---------------------------------------------------- */ 199 200 (function () { 201 202 var $contentTabs = $('.content-tabs'); 203 204 if ($contentTabs.length) { 205 206 $contentTabs.each(function (i, val) { 207 208 var $tabsNav = $('.tabs-nav', val), tabsNavLis = $tabsNav.children('li'), $tabsContainer = $('.tabs-container', val); 209 210 $tabsNav.each(function () { 211 $(this).next().children('.tab-content').first().stop(true, true).show(); 212 $(this).children('li').first().addClass('active').stop(true, true).show(); 213 }); 214 215 $(val).on('click', 'a', function (e) { 216 217 var $this = $(this).parent('li'), $index = $this.index(); 218 $this.siblings().removeClass('active').end().addClass('active'); 219 $this.parent().next().children('.tab-content').stop(true, true).hide().eq($index).stop(true, true).fadeIn(250, function () { 220 221 var self = $(this); 222 223 self.parent('.tabs-container').animate({ 224 height : self.outerHeight(true) 225 }, 200); 226 227 }); 228 e.preventDefault(); 229 }); 230 231 function adjustTabs() { 232 $tabsContainer.each(function () { 233 var $this = $(this); 234 $this.height($this.children('.tab-content:visible').outerHeight()); 235 }); 236 } 237 238 // Init 239 adjustTabs(); 240 241 // Window resize 242 $(win).on('resize', function () { 243 244 var timer = win.setTimeout(function () { 245 win.clearTimeout(timer); 246 adjustTabs(); 247 }, 30); 248 }); 249 250 }); 251 } 252 253 }()); 254 255 /* end Tabs */ 256 257 /*----------------------------------------------------*/ 258 /* Accordion and Toggle */ 259 /*----------------------------------------------------*/ 260 261 (function () { 262 263 if ($('.acc-box').length) { 264 265 var $box = $('.acc-box'); 266 267 $box.each(function () { 268 269 var $trigger = $('.acc-trigger', this); 270 271 $trigger.first().addClass('active').next().show(); 272 273 $trigger.on('click', function (e) { 274 275 var $this = $(this); 276 277 if ($this.attr('data-mode') === 'toggle') { 278 $this.toggleClass('active').next().stop(true, true).slideToggle(300); 279 } else if ($this.next().is(':hidden')) { 280 $trigger.removeClass('active').next().slideUp(300); 281 $this.toggleClass('active').next().slideDown(300); 282 } 283 e.preventDefault(); 284 }); 285 286 }); 287 288 } 289 290 }()); 291 292 /* end Accordion and Toggle */ 293 294 /*----------------------------------------------------*/ 295 /* Alert Boxes */ 296 /*----------------------------------------------------*/ 297 298 (function () { 299 300 var $notifications = $('.error, .success, .info, .notice'); 301 302 if ($notifications.length) { 303 $notifications.notifications({ 304 speed: 300 305 }); 306 } 307 308 }()); 309 310 /* ---------------------------------------------------- */ 311 /* Back to Top */ 312 /* ---------------------------------------------------- */ 313 314 (function () { 315 316 var extend = { 317 button: '#back-top', 318 text: 'Back to Top', 319 min: 200, 320 fadeIn: 400, 321 fadeOut: 400,
322 speed: 800 323 }, oldiOS = false, oldAndroid = false; 324 325 // Detect if older iOS device, which doesn't support fixed position 326 if (/(iPhone|iPod|iPad)\sOS\s[0-4][_\d]+/i.test(nav.userAgent)) { 327 oldiOS = true; 328 } 329 330 // Detect if older Android device, which doesn't support fixed position 331 if (/Android\s+([0-2][\.\d]+)/i.test(nav.userAgent)) { 332 oldAndroid = true; 333 } 334 335 $('body').append('<a href="#" id="' + extend.button.substring(1) + '" title="' + extend.text + '">' + extend.text + '</a>'); 336 337 $(win).scroll(function () { 338 var pos = $(win).scrollTop(); 339 340 if (oldiOS || oldAndroid) { 341 $(extend.button).css({ 342 'position': 'absolute', 343 'top': pos + $(win).height() 344 }); 345 } 346 347 if (pos > extend.min) { 348 $(extend.button).fadeIn(extend.fadeIn); 349 } else { 350 $(extend.button).fadeOut(extend.fadeOut); 351 } 352 353 }); 354 355 $(extend.button).on('click', function (e) { 356 $('html, body').animate({ 357 scrollTop: 0 358 }, extend.speed); 359 e.preventDefault(); 360 }); 361 362 }()); 363 364 /* end Back to Top */ 365 366 /* ---------------------------------------------------- */ 367 /* Projects Carousel */ 368 /* ---------------------------------------------------- */ 369 370 (function () { 371 372 var $carousel = $('.projects-carousel'), scrollCount; 373 374 function getWindowWidth() { 375 376 var windowWidth = $(win).width(); 377 378 if (windowWidth < 960) { 379 scrollCount = 1; 380 } else { 381 scrollCount = 4; 382 } 383 } 384 385 function resetPosition(elem, resizeEvent) { 386 if (elem.data('resize')) { 387 elem.css('left', '0'); 388 } 389 } 390 391 function initCarousel($carousels) { 392 393 $carousels.each(function () { 394 395 var $this = $(this), windowWidth = $(win).width(); 396 397 $this.jcarousel({ 398 animation: jCarousel.animation, 399 easing: jCarousel.easing, 400 scroll: $this.data('scroll-count') ? (windowWidth < 960 ? 1 : parseInt($this.data('scroll-count'))) : scrollCount, 401 itemVisibleInCallback : function() { 402 onBeforeAnimation : resetPosition($this); 403 onAfterAnimation : resetPosition($this); 404 }, 405 auto: ($this.data('auto') ? parseInt($this.data('auto')) : 0), 406 wrap: ($this.data('auto') ? 'both' : null), 407 itemFallbackDimension: 220 408 }); 409 }); 410 411 } 412 413 function adjustCarousel() { 414 415 $carousel.each(function () { 416 417 var $this = $(this), $lis = $this.children('li'), newWidth = $lis.length * $lis.first().outerWidth(true), timer; 418 419 getWindowWidth(); 420 421 if ($this.width() !== newWidth) { 422 423 $this.css('width', newWidth).data('resize', 'true'); 424 initCarousel($this); 425 $this.jcarousel('scroll', 1); 426 427 timer = win.setTimeout(function () { 428 win.clearTimeout(timer); 429 $this.data('resize', null); 430 }, 600); 431 432 } 433 434 }); 435 436 } 437 438 function swipeFunc(e, dir) { 439 440 var $carousel = $(e.currentTarget); 441 442 if (dir === 'left') { 443 $carousel.parent('.jcarousel-clip').siblings('.jcarousel-next').trigger('click'); 444 } 445 446 if (dir === 'right') { 447 $carousel.parent('.jcarousel-clip').siblings('.jcarousel-prev').trigger('click'); 448 } 449 450 } 451 452 if ($carousel.length) { 453 454 getWindowWidth(); 455 initCarousel($carousel); 456 457 // Detect Swipe 458 if (Modernizr.touch) { 459 460 $carousel.swipe({ 461 swipeLeft: swipeFunc, 462 swipeRight: swipeFunc, 463 allowPageScroll: 'auto' 464 }); 465 466 } 467 468 // Resize Window 469 $(win).on('resize', function () { 470 471 var timer = win.setTimeout(function () { 472 win.clearTimeout(timer); 473 adjustCarousel(); 474 }, 30); 475 476 }); 477 } 478 479 }()); 480 481 /* end Projects Carousel */ 482 483 /*----------------------------------------------------*/ 484 /* Search Form */ 485 /*----------------------------------------------------*/ 486 487 (function () { 488 489 var $search = $('.search-wrapper'), $text = $('input[type="text"]', $search), $submit = $('.submit-search', $search); 490 491 function closeSearch(el, text) { 492 $submit.removeClass("active"); 493 el.stop(true, false).animate({ 494 width: 0, 495 paddingRight: '35px' 496 }, 250, function () { 497 text.val("").click(function () { 498 return false; 499 }); 500 el.removeClass("active").find("input[type='text']").blur(); 501 }); 502 } 503 504 function searchAnimate(wrapper, text) { 505 wrapper.stop(true, false).animate({ 506 width: '185px', 507 paddingRight: '41px' 508 }, 250, function () { 509 wrapper.addClass("active").find("input[type='text']").focus(); 510 text.click(function () { 511 return false;
512 }); 513 }); 514 return false; 515 } 516 517 $submit.on('click', function (e) { 518 var target = $(e.target); 519 520 if ($(target).hasClass('active')) { 521 return true; 522 } else { 523 target.addClass("active"); 524 searchAnimate($search, $text); 525 } 526 return false; 527 }); 528 529 530 $('body').on('click', function (e) { 531 var current = $(e.target); 532 if ($search.hasClass('active')) { 533 if (current !== $submit) { 534 closeSearch($search, $text); 535 } 536 537 } 538 }); 539 540 }()); 541 542 /* end Search Form */ 543 544 /* ---------------------------------------------------------------------- */ 545 /* Custom Functions */ 546 /* ---------------------------------------------------------------------- */ 547 548 // Fixed scrollHorz effect 549 $.fn.cycle.transitions.fixedScrollHorz = function ($cont, $slides, opts) { 550 551 $('.post-slider-nav a').on('click', function (e) { 552 $cont.data('dir', ''); 553 if (e.target.className.indexOf('prev') > -1) { 554 $cont.data('dir', 'prev'); 555 } 556 }); 557 558 $cont.css('overflow', 'hidden'); 559 opts.before.push($.fn.cycle.commonReset); 560 var w = $cont.width(); 561 opts.animIn.left = 0; 562 opts.animOut.left = 0-w; 563 opts.cssFirst.left = 0; 564 opts.cssBefore.left = w; 565 opts.cssBefore.top = 0; 566 567 if ($cont.data('dir') === 'prev') { 568 opts.cssBefore.left = -w; 569 opts.animOut.left = w; 570 } 571 572 }; 573 574 /* ---------------------------------------------------- */ 575 /* Image Post Slider */ 576 /* ---------------------------------------------------- */ 577 578 (function () { 579 580 function swipeFunc(e, dir) { 581 582 var $postslider = $(e.currentTarget); 583 584 // Enable swipes if more than one slide 585 if ($postslider.data('slideCount') > 1) { 586 587 $postslider.data('dir', ''); 588 589 if (dir === 'left') { 590 $postslider.cycle('next'); 591 } 592 593 if (dir === 'right') { 594 $postslider.data('dir', 'prev'); 595 $postslider.cycle('prev'); 596 } 597 } 598 } 599 600 var $postslider = $('.image-post-slider > ul'); 601 602 if ($postslider.length) { 603 604 $postslider.each(function (i) { 605 606 var $this = $(this); 607 608 $this.css('height', $this.children('li:first').height()).after('<div class="post-slider-nav"><a class="prevBtn post-nav-prev-' + i + '">Prev</a><a class="nextBtn post-nav-next-' + i + '">Next</a></div>').cycle({ 609 before: function (curr, next, opts) { 610 var $this = $(this); 611 $this.parent().stop().animate({ 612 height: $this.height() 613 }, opts.speed); 614 }, 615 containerResize: false, 616 easing: objPostSlider.easing, 617 fx: 'fixedScrollHorz', 618 fit: true, 619 next: '.post-nav-next-' + i, 620 pause: true, 621 prev: '.post-nav-prev-' + i, 622 slideResize: true, 623 speed: objPostSlider.speed, 624 timeout: objPostSlider.timeout, 625 width: '100%' 626 }).data('slideCount', $postslider.children('li').length); 627 }); 628 629 // Pause on Nav Hover 630 $('.post-slider-nav a').on('mouseenter', function () { 631 $(this).parent().prev().cycle('pause'); 632 }).on('mouseleave', function () { 633 $(this).parent().prev().cycle('resume'); 634 }); 635 636 // Hide navigation if only a single slide 637 if ($postslider.data('slideCount') <= 1) { 638 $postslider.next('.post-slider-nav').hide(); 639 } 640 641 // Resize 642 $(win).on('resize', function () { 643 $postslider.css('height', $postslider.find('li:visible').height()); 644 }); 645 646 // Include Swipe 647 if (Modernizr.touch) { 648 649 $postslider.swipe({ 650 swipeLeft: swipeFunc, 651 swipeRight: swipeFunc, 652 allowPageScroll: 'auto' 653 }); 654 655 } 656 } 657 658 }()); 659 660 /* ---------------------------------------------------- */ 661 /* Image Gallery Slider */ 662 /* ---------------------------------------------------- */ 663 664 (function () { 665 666 function swipeFunc(e, dir) { 667 668 var $projects = $(e.currentTarget); 669 670 // Enable swipes if more than one slide 671 if ($projects.data('slideCount') > 1) { 672 673 $projects.data('dir', ''); 674 675 if (dir === 'left') { 676 $projects.cycle('next'); 677 } 678 679 if (dir === 'right') { 680 $projects.data('dir', 'prev'); 681 $projects.cycle('prev'); 682 } 683 684 } 685 686 } 687 688 var $projects = $('.image-gallery-slider > ul'); 689 690 if ($projects.length) { 691 692 $(win).load(function () { 693 694 $projects.each(function (i) { 695 696 var $this = $(this); 697 698 $this.css('height', $this.children('li:first').height()).after('<div class="gallery-slider-nav"><a class="prevBtn gallery-nav-prev-' + i + '">Prev</a> <a class="nextBtn gallery-nav-next-' + i + '">Next</a> </div>').cycle({ 699 before: function (curr, next, opts) { 700 var $this = $(this); 701 $this.parent().stop().animate({ 702 height: $this.height() 703 }, opts.speed); 704 }, 705 containerResize: false, 706 easing: objGallerySlider.easing, 707 fit: true, 708 next: '.gallery-nav-next-' + i, 709 pause: true, 710 prev: '.gallery-nav-prev-' + i, 711 slideResize: true, 712 speed: objGallerySlider.speed, 713 timeout: objGallerySlider.timeout, 714 width: '100%' 715 }).data('slideCount', $projects.children('li').length); 716 }); 717 718 // Pause on Nav Hover 719 $('.gallery-nav a').on('mouseenter', function () { 720 $(this).parent().prev().cycle('pause'); 721 }).on('mouseleave', function () { 722 $(this).parent().prev().cycle('resume'); 723 }); 724 725 // Hide navigation if only a single slide 726 if ($projects.data('slideCount') <= 1) { 727 $projects.next('.projects-nav').hide(); 728 } 729 730 }); 731 732 // Resize 733 $(win).on('resize', function () { 734 $projects.css('height', $projects.find('li:visible').height()); 735 }); 736 737 // Include Swipe 738 if (Modernizr.touch) { 739 740 $projects.swipe({ 741 swipeLeft: swipeFunc, 742 swipeRight: swipeFunc, 743 allowPageScroll: 'auto' 744 }); 745 746 } 747 } 748 749 }()); 750 751 /* ---------------------------------------------------- */ 752 /* Testimonials */ 753 /* ---------------------------------------------------- */ 754 755 (function () { 756 757 function swipeFunc(e, dir) { 758 759 var $quotes = $(e.currentTarget); 760 761 // Enable swipes if more than one slide 762 if ($quotes.data('slideCount') > 1) { 763 764 $quotes.data('dir', ''); 765 766 if (dir === 'left') { 767 $quotes.cycle('next'); 768 } 769 770 if (dir === 'right') { 771 $quotes.data('dir', 'prev'); 772 $quotes.cycle('prev'); 773 } 774 775 } 776 777 } 778 779 var $quotes = $('.testimonials'); 780 781 if ($quotes.length) { 782 783 $quotes.each(function (i) { 784 785 var $this = $(this); 786 787 $this.css('height', $this.children('li:first').height()).cycle({ 788 before: function (curr, next, opts) { 789 var $this = $(this); 790 $this.parent().stop().animate({ 791 height: $this.height() 792 }, opts.speed); 793 }, 794 containerResize: false, 795 easing: objTestimonials.easing, 796 fit: true, 797 next: '', 798 pause: true, 799 prev: '', 800 slideResize: true, 801 speed: objTestimonials.speed, 802 timeout: objTestimonials.timeout, 803 width: '100%' 804 }).data('slideCount', $this.children('li').length); 805 806 }); 807 808 // Resize 809 $(win).on('resize', function () { 810 $quotes.css('height', $quotes.find('li:visible').height()); 811 }); 812 813 // Include Swipe 814 if (Modernizr.touch) { 815 816 $quotes.swipe({ 817 swipeLeft: swipeFunc, 818 swipeRight: swipeFunc, 819 allowPageScroll: 'auto' 820 }); 821 822 } 823 } 824 825 }()); 826 827 /* ---------------------------------------------------- */ 828 /* Fancybox */ 829 /* ---------------------------------------------------- */ 830 831 (function () { 832 833 if ($('.single-image.link-icon').length || $('.single-image.plus-icon').length || $('.single-image.video-icon').length) { 834 835 // Link Icon 836 $('.single-image.link-icon, .single-image.plus-icon').fancybox({ 837 'titleShow': true, 838 'transitionIn': 'fade', 839 'transitionOut': 'fade', 840 'easingIn': 'easeOutBack', 841 'easingOut': 'easeInBack', 842 helpers: { 843 title: { 844 type: 'over' 845 } 846 } 847 }).each(function () { 848 $(this).append('<span class="curtain"></span>'); 849 }); 850 851 // Video Icon 852 $('.single-image.video-icon').fancybox({ 853 type: 'iframe', 854 openEffect: 'fade', 855 closeEffect: 'fade', 856 nextEffect: 'fade', 857 prevEffect: 'fade', 858 helpers: { 859 title: { 860 type: 'over' 861 } 862 }, 863 width: '70%', 864 height: '70%', 865 maxWidth: 800, 866 maxHeight: 600, 867 fitToView: false, 868 autoSize: false 869 }).each(function () { 870 $(this).append('<span class="curtain"></span>'); 871 }); 872 873 } 874 875 }()); 876 877 /* end Fancybox --> End */ 878 879 /* ---------------------------------------------------- */ 880 /* Blackandwhite */ 881 /* ---------------------------------------------------- */ 882 883 (function () { 884 885 if ($('.bwWrapper').length) { 886 887 var obj = { 888 '.flexslider' : '.flex-direction-nav', 889 '.image-post-slider' : '.post-slider-nav', 890 '.image-gallery-slider' : '.gallery-slider-nav' 891 }, $bw = $('.bwWrapper:not(.badge)'); 892 893 $.fn.extendBW = function (object) { 894 $.each(object, function (cont, nav) { 895 $(cont).on('mouseenter', ' ' + nav + ' ' + 'a', function () { 896 $(cont).find('canvas, .BWfade').hide(); 897 $(nav).on('mouseleave', function () { 898 $(cont).find('canvas, .BWfade').show(0); 899 }); 900 }); 901 }); 902 }; 903 904 $.fn.extendBW(obj); 905 906 if (Modernizr.touch) { 907 908 $(win).load(function () { 909 $bw.BlackAndWhite(objBlackAndWhiteTouch); 910 }); 911 912 } else { 913 914 $(win).load(function () { 915 $bw.BlackAndWhite(objBlackAndWhite); 916 }); 917 } 918 919 } 920 921 }()); 922 923 /* end BlackAndWhite --> End */ 924 925 /* ---------------------------------------------------- */ 926 /* Portfolio */ 927 /* ---------------------------------------------------- */ 928 929 (function () { 930 931 var $cont = $('#portfolio-items'), $itemsFilter, mouseOver; 932 933 if ($cont.length) { 934 935 $itemsFilter = $('#portfolio-filter'); 936 937 // Copy categories to item classes 938 $cont.children('article').each(function (i) { 939 var $this = $(this); 940 $this.addClass($this.attr('data-categories')); 941 }); 942 943 // Run Isotope when all images are fully loaded 944 $(win).on('load', function () { 945 946 $cont.isotope({ 947 itemSelector: 'article', 948 layoutMode: 'fitRows' 949 }); 950 951 }); 952 953 // Filter projects 954 $itemsFilter.on('click', 'a', function (e) { 955 956 var $this = $(this), currentOption = $this.attr('data-categories'); 957 958 $itemsFilter.find('a').removeClass('active'); 959 $this.addClass('active'); 960 961 if (currentOption) { 962 if (currentOption !== '*') { 963 currentOption = currentOption.replace(currentOption, '.' + currentOption); 964 } 965 $cont.isotope({ 966 filter: currentOption 967 }, function() { 968 if (currentOption == '*') { 969 $('.single-image', $cont).attr('rel', 'gallery'); 970 } else { 971 $(currentOption, $cont).find('.single-image').attr('rel', currentOption.substring(1)); 972 } 973 }); 974 } 975 e.preventDefault(); 976 }); 977 978 $itemsFilter.find('a').first().addClass('active'); 979 } 980 981 }()); 982 983 /* end Portfolio */ 984 985 /* ---------------------------------------------------- */ 986 /* FitVids */ 987 /* ---------------------------------------------------- */ 988 989 (function () { 990 991 function adjustVideos() { 992 993 var $videos = $('.video-container'); 994 995 $videos.each(function () { 996 997 var $this = $(this), playerWidth = $this.parent().actual('width'), playerHe
997ight = playerWidth / $this.data('aspectRatio'); 998 999 $this.css({ 1000 'height' : playerHeight, 1001 'width' : playerWidth 1002 }); 1003 }); 1004 } 1005 1006 $('.container').each(function () { 1007 1008 var selectors = [ 1009 "iframe[src^='player.vimeo.com']", 1010 "iframe[src^='www.youtube.com']", 1011 "object", 1012 "embed" 1013 ], $allVideos = $(this).find(selectors.join(',')); 1014 1015 $allVideos.each(function () { 1016 1017 var $this = $(this), 1018 videoHeight = $this.attr('height') || $this.actual('width'), 1019 videoWidth = $this.attr('width') || $this.actual('width'); 1020 1021 if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.video-container').length) { 1022 return; 1023 } 1024 1025 $this.css({ 1026 'height' : '100%', 1027 'width' : '100%' 1028 }).removeAttr('height').removeAttr('width').wrap('<div class="video-container"></div>').parent('.video-container').css({ 1029 'height' : videoHeight, 1030 'width' : videoWidth 1031 }).data('aspectRatio', videoWidth / videoHeight); 1032 adjustVideos(); 1033 }); 1034 1035 }); 1036 1037 $(win).on('resize', function () { 1038 var timer = win.setTimeout(function () { 1039 win.clearTimeout(timer); 1040 adjustVideos(); 1041 }, 30); 1042 }); 1043 1044 }()); 1045 1046 /* end FitVids */ 1047 1048 /* ---------------------------------------------------- */ 1049 /* Preloader */ 1050 /* ---------------------------------------------------- */ 1051 1052 (function () { 1053 1054 $.preloader = function (el, options) { 1055 var elem = $(el), methods = {}, 1056 elements = elem.find('.preloader'), 1057 o = $.extend({}, $.preloader.defaults, options); 1058 1059 methods = { 1060 init: function () { 1061 this.loader(); 1062 this.eventListener(); 1063 }, 1064 eventListener: function () { 1065 $(win).load(function () { 1066 elements.each(function (i, val) { 1067 $(val).removeClass('loader'); 1068 }); 1069 }); 1070 }, 1071 loader: function () { 1072 elements.each(function (i, val) { 1073 win.setTimeout(function () { 1074 $(val).addClass('loader'); 1075 }, i * o.speed); 1076 }); 1077 } 1078 }; 1079 methods.init(); 1080 1081 }; 1082 1083 $.preloader.defaults = {speed : 250}; 1084 1085 $.fn.preloader = function (options) { 1086 if (typeof options === 'object') { 1087 return this.each(function () { 1088 new $.preloader(this, options); 1089 }); 1090 }; 1091 }; 1092 1093 $('.container').preloader({ 1094 speed: 300 1095 }); 1096 1097 }()); 1098 1099 /* end Preloader */ 1100 1101 /* ---------------------------------------------------- */ 1102 /* Detail Blocks */ 1103 /* ---------------------------------------------------- */ 1104 1105 (function () { 1106 1107 if ($('.detail-box').length && $('.transform').length) { 1108 1109 var box = $('.detail-box'), 1110 methods = {}, 1111 empty = function (mixed_var) { 1112 return (mixed_var === "" || mixed_var === 0 || mixed_var === "0" || mixed_var === null || mixed_var === false || mixed_var.length === 0); 1113 } 1114 1115 methods = { 1116 colorState: function (elem, color) { 1117 $(elem).addClass('stateColor').children('.transform').css({ 1118 backgroundColor: color 1119 }); 1120 }, 1121 colorHover : function (el, color) { 1122 1123 var elem = $(el).children('.transform'), 1124 colorState = methods.getState(elem), 1125 colorHover = methods.getHover(elem); 1126 1127 if (!empty(colorHover) && empty(colorState)) { 1128 1129 } else if (!empty(colorState)) { 1130 $(el).css({ 1131 backgroundColor: color 1132 }); 1133 } 1134 1135 }, 1136 eventOnHover : function () { 1137 1138 box.on('mouseenter', function () { 1139 var el = $(this); 1140 methods.removeState(el); 1141 }).on('mouseleave', function () { 1142 var el = $(this), 1143 elem = el.children('.transform'), 1144 colorState = methods.getState(elem), 1145 colorHover = methods.getHover(elem); 1146 1147 if (!empty(colorState) && empty(colorHover)) { 1148 methods.colorState(el, colorState); 1149 } else if (!empty(colorHover) && !empty(colorState)) { 1150 elem.css(methods.objHover); 1151 } else if (empty(colorState) && empty(colorHover)) { 1152 el.removeClass('defaultState'); 1153 elem.css(methods.objState); 1154 } else if (!empty(colorHover) && empty(colorState)) { 1155 el.removeClass('stateColor'); 1156 } 1157 1158 }); 1159 1160 }, 1161 objState : { 1162 'height' : 0, 1163 'opacity': 0 1164 }, 1165 objHover : { 1166 'height' : '100%', 1167 'opacity': 1 1168 }, 1169 getState : function (el) { 1170 return el.data('color-state'); 1171 }, 1172 getHover : function (el) { 1173 return el.data('color-hover'); 1174 }, 1175 removeState : function (elem) { 1176 1177 if (!empty(elem)) { 1178 1179 var el = elem.children('.transform'), 1180 attrState = methods.getState(el), 1181 attrHover = methods.getHover(el); 1182 1183 if (!empty(attrState) && empty(attrHover)) { 1184 1185 if (elem.hasClass('stateColor')) { 1186 elem.removeClass('stateColor'); 1187 } 1188 1189 } else if (!empty(attrState) && !empty(attrHover)) { 1190 el.css(methods.objState); 1191 } else if (!empty(attrHover) && empty(attrState)) { 1192 methods.colorState(elem, attrHover); 1193 } else if (empty(attrState) && empty(attrHover)) { 1194 elem.addClass('defaultState'); 1195 el.css(methods.objHover); 1196 } 1197 1198 } 1199 1200 }, 1201 init : function () { 1202 this.eventOnHover(); 1203 } 1204 } 1205 1206 methods.init(); 1207 1208 box.each(function (idx, val) { 1209 1210 var el = $(val).children('.transform'), 1211 attrState = methods.getState(el), 1212 attrHover = methods.getHover(el); 1213 1214 if (!empty(attrState)) { 1215 methods.colorState(val, attrState); 1216 } 1217 1218 if (!empty(attrHover)) { 1219 methods.colorHover(val, attrHover); 1220 } 1221 1222 }); 1223 1224 } 1225 1226 }()); 1227 1228 /* end Detail Detail Blocks */ 1229 1230 /* ---------------------------------------------------- */ 1231 /* Detail Detect touch */ 1232 /* ---------------------------------------------------- */ 1233 1234 (function () { 1235 1236 if (Modernizr.touch) { 1237 1238 var detailBox = $('.detail-box'); 1239 1240 detailBox.on('click', function (e) { 1241 var target = $(e.target); 1242 target.addClass('touched'); 1243 }); 1244 } 1245 1246 }()); 1247 1248 /* end Detail Detect touch */ 1249 1250 /* ---------------------------------------------------- */ 1251 /* Google Maps */ 1252 /* ---------------------------------------------------- */ 1253 1254 (function () { 1255 1256 if ($('.google_map').length) { 1257 var $gmap = $('.google_map'), mapType; 1258 1259 /* Maptype: 1260 google.maps.MapTypeId.ROADMAP 1261 google.maps.MapTypeId.SATELLITE 1262 google.maps.MapTypeId.HYBRID 1263 google.maps.MapTypeId.TERRAIN */ 1264 1265 if (win.google) { 1266 mapType = google.maps.MapTypeId.TERRAIN; 1267 } 1268 1269 objGoogleMap.maptype = mapType; 1270 $gmap.gMap(objGoogleMap); 1271 } 1272 1273 }()); 1274 1275 /* end Google Maps */ 1276 1277 /* ---------------------------------------------------- */ 1278 /* Contact Form */ 1279 /* ---------------------------------------------------- */ 1280 1281 (function () { 1282 1283 if ($('.contact-form').length) { 1284 1285 var $form = $('.contact-form'), 1286 $loader = '<span>
1286Loader...</span>'; 1287 $form.append('<div class="hide contact-form-responce" />'); 1288 1289 $form.each(function () { 1290 1291 var $this = $(this), $response = $('.contact-form-responce', $this).append('<p></p>'); 1292 1293 $this.submit(function () { 1294 1295 $response.find('p').html($loader); 1296 1297 var data = { 1298 action: "contact_form_request", 1299 values: $this.serialize() 1300 }; 1301 1302 //send data to server 1303 $.post("php/contact-send.php", data, function (response) { 1304 1305 response = $.parseJSON(response); 1306 1307 $(".wrong-data", $this).removeClass("wrong-data"); 1308 $response.find('span').remove(); 1309 1310 if (response.is_errors) { 1311 1312 $response.find('p').removeClass().addClass("error"); 1313 $.each(response.info, function (input_name, input_label) { 1314 $("[name=" + input_name + "]", $this).addClass("wrong-data"); 1315 $response.find('p').append('Please enter correctly "' + input_label + '"!' + '</br>'); 1316 }); 1317 1318 $response.show(300); 1319 1320 } else { 1321 1322 $response.find('p').removeClass().addClass('success'); 1323 1324 if (response.info === 'success') { 1325 $response.find('p').append('Your email has been sent!'); 1326 $this.find('input:not(input[type="submit"], button), textarea, select').val('').attr('checked', false); 1327 $response.show(300).delay(2500).hide(400); 1328 } 1329 1330 if (response.info === 'server_fail') { 1331 $response.find('p').append('Server failed. Send later!'); 1332 $response.show(300); 1333 } 1334 } 1335 1336 // Scroll to bottom of the form to show respond message 1337 var bottomPosition = $response.offset().top; 1338 1339 if ($(doc).scrollTop() < bottomPosition) { 1340 $('html, body').animate({ scrollTop : bottomPosition }); 1341 } 1342 1343 }); 1344 1345 return false; 1346 1347 }); 1348 }); 1349 1350 } 1351 1352 }()); 1353 1354 /* end Contact Form */ 1355 1356 /* ---------------------------------------------------- */ 1357 /* Ajax Navigation */ 1358 /* ---------------------------------------------------- */ 1359 1360 (function () { 1361 1362 $.ajaxnav = function(el) { 1363 1364 var element = $(el), 1365 methods = {}; 1366 1367 methods = { 1368 elements: { 1369 '.ajax-nav': 'navList', 1370 '.ajax-content': 'content', 1371 '.ajax-navigation-item': 'list' 1372 }, 1373 proxy: function(func) { return $.proxy(func, this); }, 1374 init: function() { 1375 this.refreshElements(); 1376 this.eventsListener(); 1377 }, 1378 $: function(selector) { 1379 return $(selector, element); 1380 }, 1381 refreshElements: function() { 1382 for (var key in this.elements) { 1383 this[this.elements[key]] = this.$(key); 1384 } 1385 }, 1386 eventsListener: function() { 1387 var that = this; 1388 this.navList.children('li').first().addClass('current'); 1389 this.proxy(that.clickEvents(that), that); 1390 }, 1391 clickEvents: function(that) { 1392 this.navList.on('click', 'a', function(e) { 1393 var $this = $(this).parent('li'), $index = $this.index(); 1394 $this.siblings('li').removeClass('current').end().addClass('current'); 1395 that.content.find(methods.list).hide().end().eq($index).stop(true, true).show(700); 1396 e.preventDefault(); 1397 }); 1398 } 1399 }; 1400 methods.init(); 1401 }; 1402 1403 $.fn.ajaxnav = function() { 1404 return this.each(function() { 1405 new $.ajaxnav(this); 1406 }); 1407 }; 1408 1409 $(function() { 1410 $('.container').ajaxnav(); 1411 }); 1412 1413 }()); 1414 1415 /* end Ajax Navigation */ 1416 1417 }); 1418 1419 /* ---------------------------------------------------- */ 1420 /* Notifications */ 1421 /* ---------------------------------------------------- */ 1422 1423 $.fn.notifications = function (options) { 1424 1425 var defaults = {speed: 200}, o = $.extend({}, defaults, options); 1426 1427 return this.each(function () { 1428 1429 var closeBtn = $('<a class="alert-close" href="#"></a>'), 1430 closeButton = $(this).append(closeBtn).find('> .alert-close'); 1431 1432 function fadeItSlideIt(object) { 1433 object.fadeTo(o.speed, 0, function () { 1434 object.slideUp(o.speed); 1435 }); 1436 } 1437 1438 closeButton.click(function () { 1439 fadeItSlideIt($(this).parent()); 1440 return false; 1441 }); 1442 }); 1443 }; 1444 1445 /* end jQuery Notifications */ 1446 1447 /* ---------------------------------------------------- */ 1448 /* Actual Plugin */ 1449 /* ---------------------------------------------------- */ 1450 1451 // jQuery Actual Plugin - Version: 1.0.13 (dreamerslab.com/) 1452 ;(function(a){a.fn.extend({actual:function(b,l){if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';}var f={absolute:false,clone:false,includeMargin:false};var i=a.extend(f,l);var e=this.eq(0);var h,j;if(i.clone===true){h=function(){var m="position: absolute !important; top: -1000 !important; ";e=e.clone().attr("style",m).appendTo("body");};j=function(){e.remove();};}else{var g=[];var d="";var c;h=function(){c=e.parents().andSelf().filter(":hidden");d+="visibility: hidden !important; display: block !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);g.push(m.attr("style"));m.attr("style",d);});};j=function(){c.each(function(m){var o=a(this);var n=g[m];if(n===undefined){o.removeAttr("style");}else{o.attr("style",n);}});};}h();var k=/(outer)/g.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});})(jQuery); 1453 1454 /* end jQuery Actual Plugin */ 1455 1456}(jQuery, window, Modernizr, navigator, document));
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.