/*jslint browser: true*/ /*global $, jQuery, Modernizr, google, _gat*/ /*jshint strict: true */ $(window).load(function(){ $('#preloader').fadeOut('slow',function(){$(this).remove();}); }); var isMobile = false; var isDesktop = false; $(window).on("load resize",function(e){ //mobile detection if(Modernizr.mq('only all and (max-width: 767px)') ) { isMobile = true; }else{ isMobile = false; } //tablette and mobile detection if(Modernizr.mq('only all and (max-width: 1024px)') ) { isDesktop = false; }else{ isDesktop = true; } toTop(isMobile); }); //RESIZE EVENTS $(window).resize(function () { Modernizr.addTest('ipad', function () { return !!navigator.userAgent.match(/iPad/i); }); if (!Modernizr.ipad) { initializeMainMenu(); } /* Reload the page to make sure everything fits in its media query*/ //window.location.href = window.location.href; }); /* |-------------------------------------------------------------------------- | DOCUMENT READY |-------------------------------------------------------------------------- */ $(document).ready(function() { "use strict"; $(this).scrollTop(0); /** INIT FUNCTIONS **/ initializeMainMenu(); /** |-------------------------------------------------------------------------- | fullwidth image |-------------------------------------------------------------------------- */ /** FULLSCREEN IMAGE **/ $(window).on("resize",function(e){ if ($('#homeFullScreen').length){ fullscreenImage(); } }); if ($('#homeFullScreen').length){ fullscreenImage(); } /* |-------------------------------------------------------------------------- | Menu Fixed (multipage) |-------------------------------------------------------------------------- */ $(window).on('scroll.nekofixedmenu', function () { if( $(window).width() > 1025 ){ if( $(window).scrollTop() < 100 ){ $('#mainHeader').removeClass('fixedHeader'); $('#mainHeader').css({ 'display': 'block', 'margin-top': '0' }); }else{ if( !$('#mainHeader').hasClass('fixedHeader') ){ $('#mainHeader').animate( {'margin-top': '-400px'}, 0, function() { $('#mainHeader').addClass('fixedHeader'); $('#mainHeader').animate( {'margin-top': '0'}, 300, 'easeInOutCirc',function() { }); }); } } } }); /* if( $(window).scrollTop() < 100 ){ $('#mainHeader').removeClass('fixedHeader'); }else{ $('#mainHeader').addClass('fixedHeader'); } */ //$(window).trigger('scroll.nekofixedmenu'); /* |-------------------------------------------------------------------------- | form placeholder for IE |-------------------------------------------------------------------------- */ if(!Modernizr.input.placeholder){ $('[placeholder]').focus(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); input.removeClass('placeholder'); } }).blur(function() { var input = $(this); if (input.val() == '' || input.val() == input.attr('placeholder')) { input.addClass('placeholder'); input.val(input.attr('placeholder')); } }).blur(); $('[placeholder]').parents('form').submit(function() { $(this).find('[placeholder]').each(function() { var input = $(this); if (input.val() == input.attr('placeholder')) { input.val(''); } }) }); } /* |-------------------------------------------------------------------------- | CONTACT |-------------------------------------------------------------------------- */ $('.slideContact').click(function(e){ if ( $(window).width() >= 800){ $('#contact').slideToggle('normal', 'easeInQuad',function(){ $('#contactinfoWrapper').css('margin-left', 0); $('#mapSlideWrapper').css('margin-left', 3000); $('#contactinfoWrapper').fadeToggle(); }); $('#closeContact').fadeToggle(); return false; }else{ return true; } e.preventDefault(); }); $('#closeContact').click(function(e){ $('#contactinfoWrapper').fadeOut('normal', 'easeInQuad',function(){ $('#contactinfoWrapper').css('margin-left', 0); $('#mapSlideWrapper').css('margin-left', 3000); }); $('#contact').slideUp('normal', 'easeOutQuad'); $(this).fadeOut(); e.preventDefault(); }); /* |-------------------------------------------------------------------------- | SLICK CAROUSEL |-------------------------------------------------------------------------- */ $('.carouselLogos').slick({ dots: false, infinite: true, slidesToShow: 6, slidesToScroll: 1, autoplay: true, autoplaySpeed: 2000, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 6, slidesToScroll: 1, infinite: true, dots: true } }, { breakpoint: 980, settings: { slidesToShow: 4, slidesToScroll: 1 } }, { breakpoint: 480, settings: { slidesToShow: 2, slidesToScroll: 1 } } // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ] }); $('.reviewFade').slick({ dots: false, infinite: true, speed: 500, fade: true, autoplay: true, autoplaySpeed: 4000, cssEase: 'linear' }); /* |-------------------------------------------------------------------------- | ROLLOVER BTN |-------------------------------------------------------------------------- */ if($('.imgHover').length){ if(!Modernizr.csstransitions && !Modernizr.touch){ $('.imgHover figure').addClass('noCss3'); $('.imgHover figure').hover( function() { if( $(this).parents('.imgHover').hasClass('HM-hover-1') ){ $('img', this).stop(true, false).animate({ bottom: '+=40px' }, 400, 'easeOutQuad',function() {}).end(); var captionHeight = $('figcaption', this).outerHeight(true); $('figcaption', this).stop(true, false).animate({ bottom: captionHeight }, 400, 'easeOutQuad',function() {}).end(); }else if( $(this).parents('.imgHover').hasClass('HM-hover-2') ){ $('.pinInfo h1, .pinInfo h2, .pinInfo h3, .pinInfo h4, .pinInfo h5, .pinInfo h6', this).css({ "-ms-transform":"translateY(0)", "opacity": 1 }); $('.pinInfo p', this).css({ "opacity": 1 }); $('.iconLinks', this).css({ "-ms-transform":"translate(-50%,0)"}); $('.projectLink', this).css({ "-ms-transform":"translate(-50%,0)"}); $('figcaption', this).animate({ opacity: 1}, 300, function() { }); } }, function() { if( $(this).parents('.imgHover').hasClass('HM-hover-1') ){ $('img', this).stop(true, false).animate({ bottom: '0' }, 400, 'easeOutQuad',function() {}).end(); $('figcaption', this).stop(true, false).animate({ bottom: 0 }, 400, 'easeOutQuad',function() {}).end(); }else if( $(this).parents('.imgHover').hasClass('HM-hover-2') ){ $('figcaption', this).animate({ opacity: 0}, 300, function() { }); } }); } } /* |-------------------------------------------------------------------------- | ROLLOVER BTN |-------------------------------------------------------------------------- */ $('.socialIcon').hover( function () { $(this).stop(true, true).addClass('socialHoverClass', 300); }, function () { $(this).removeClass('socialHoverClass', 300); }); $('.tabs li, .accordion h2').hover( function () { $(this).stop(true, true).addClass('speBtnHover', 300); }, function () { $(this).stop(true, true).removeClass('speBtnHover', 100); }); /* |-------------------------------------------------------------------------- | ALERT |-------------------------------------------------------------------------- */ $('.alert').delegate('button', 'click', function() { $(this).parent().fadeOut('fast'); }); /* |-------------------------------------------------------------------------- | CLIENT |-------------------------------------------------------------------------- */ if($('.colorHover').length){ var array =[]; $('.colorHover').hover( function () { array[0] = $(this).attr('src'); $(this).attr('src', $(this).attr('src').replace('-off', '')); }, function () { $(this).attr('src', array[0]); }); } /* |-------------------------------------------------------------------------- | Rollover boxIcon |-------------------------------------------------------------------------- */ if($('.boxIcon').length){ $('.boxIcon').hover(function() { var $this = $(this); $this.css('opacity', '1'); //$this.find('.boxContent>p').stop(true, false).css('opacity', 0); $this.addClass('hover'); $('.boxContent>p').css('bottom', '-50px'); $this.find('.boxContent>p').stop(true, false).css('display', 'block'); $this.find('.iconWrapper i').addClass('triggeredHover'); $this.find('.boxContent>p').stop(true, false).animate({ 'margin-top': '0px'}, 300, function() { // stuff to do after animation is complete }); }, function() { var $this = $(this); $this.removeClass('hover'); $this.find('.boxContent>p').stop(true, false).css('display', 'none'); $this.find('.boxContent>p').css('margin-top', '250px'); $this.find('.iconWrapper i').removeClass('triggeredHover'); }); } /* |-------------------------------------------------------------------------- | ROLL OVER PreviewTrigger |-------------------------------------------------------------------------- */ if($('.previewTrigger').length){ $('.mask').css('height', $('.previewTrigger').height()); $('.mask').css('width', $('.previewTrigger').width()); // $('.mask', this).css('top', $('.previewTrigger', this).width()); // $('.mask', this).css('left', $('.previewTrigger', this).width()); $('.previewTrigger').hover(function() { var $this = $(this); $this.children('.mask').fadeIn('fast'); if(Modernizr.csstransitions) { $('.iconWrapper', $this).addClass('animated'); $('.iconWrapper', $this).css('display', 'block'); $('.iconWrapper', $this).removeClass('flipOutX'); $('.iconWrapper', $this).addClass('bounceInDown'); }else{ $('.iconWrapper', $this).stop(true, false).fadeIn('fast'); } }, function() { var $this = $(this); $this.children('.mask').fadeOut('fast'); if(Modernizr.csstransitions) { $('.iconWrapper', $this).removeClass('bounceInDown'); $('.iconWrapper', $this).addClass('flipOutX'); $('.iconWrapper', $this).css('display', 'none'); $('.iconWrapper', $this).removeClass('animated'); }else{ $('.iconWrapper', $this).stop(true, false).fadeOut('fast'); } }); } /* |-------------------------------------------------------------------------- | APPEAR |-------------------------------------------------------------------------- */ if($('.activateAppearAnimation').length){ AnimAppear(); $('.reloadAnim').click(function (e) { $(this).parent().parent().find('img[data-Anim]').attr('class', '').addClass('img-responsive'); AnimAppear(); e.preventDefault(); }); } //END DOCUMENT READY }); /* |-------------------------------------------------------------------------- | EVENTS TRIGGER AFTER ALL IMAGES ARE LOADED |-------------------------------------------------------------------------- */ $(window).load(function() { "use strict"; /* |-------------------------------------------------------------------------- | PRELOADER |-------------------------------------------------------------------------- */ if($('#nekoStatus').length){ $('#nekoStatus').fadeOut('slow', function() { $('#preloader').fadeOut('slow'); }); } //END WINDOW LOAD }); /* |-------------------------------------------------------------------------- | FUNCTIONS |-------------------------------------------------------------------------- */ function fullscreenImage(){ $('#homeFullScreen').css({height:$(window).height()}); $('#homeFullScreen').css({width:$(window).width()}); } /* Appear function */ function AnimAppear(){ $("[data-Anim]").each(function() { var $this = $(this); $this.addClass("Anim-invisible"); if($(window).width() > 767) { $this.appear(function() { var delay = ($this.data("delay") ? $this.data("delay") : 1); if(delay > 1) $this.css("animation-delay", delay + "ms"); $this.addClass("Anim-animated"); $this.addClass('Anim-'+$this.data("anim")); setTimeout(function() { $this.addClass("Anim-visible"); }, delay); }, {accX: 0, accY: -150}); } else { $this.animate({ opacity: 1 }, 300, 'easeInOutQuad',function() { }); } }); } /* CONTACT FROM */ $(function() { "use strict"; if( $("#contactfrm").length ){ $.validator.setDefaults({ highlight: function(element) { $(element).closest('.form-group').addClass('has-error has-feedback'); if(!$(element).closest('.form-group').find('.form-control-feedback').length){ $(element).closest('.form-group').append(''); } }, unhighlight: function(element) { $(element).closest('.form-group').removeClass('has-error has-feedback'); $(element).closest('.form-group').find('.form-control-feedback').remove(); }, errorElement: 'span', errorClass: 'help-block', errorPlacement: function(error, element) { if(element.parent('.input-group').length) { error.insertAfter(element.parent()); } else { error.insertAfter(element); } } }); $("#contactfrm").validate({ /* debug: true, */ submitHandler: function(form) { $(form).ajaxSubmit({ type: "POST", url: "js-plugin/contact-ajax-plugin/php/form-handler.php", target: ".result", success: function(){ if($('.result .alert-success').length){ $("#contactfrm").trigger('reset'); } } }); }, onkeyup: false, onclick: false, rules: { name: { required: true, minlength: 3 }, email: { required: true, email: true }, comment: { required: true, minlength: 10, maxlength: 350 } } }); } }); /* CONTACT FROM */ /* MAIN MENU (submenu slide and setting up of a select box on small screen)*/ function initializeMainMenu() { "use strict"; var $mainMenu = $('#mainMenu').children('ul'); /* Mobile */ if(Modernizr.mq('only all and (max-width: 1024px)') ) { // Responsive Menu Events var addActiveClass = false; $("a.hasSubMenu").unbind('click'); $('li',$mainMenu).unbind('mouseenter mouseleave'); $("a.hasSubMenu").on("click", function(e) { var $this = $(this); e.preventDefault(); addActiveClass = $this.parent("li").hasClass("Nactive"); $this.parent("li").removeClass("Nactive"); $this.next('.subMenu').slideUp('fast'); if(!addActiveClass) { $this.parents("li").addClass("Nactive"); $this.next('.subMenu').slideDown('fast'); }else{ $this.parent().parent('li').addClass("Nactive"); } return; }); /* Tablet */ }else{ $("li", $mainMenu).removeClass("Nactive"); $('a', $mainMenu).unbind('click'); $('li',$mainMenu).hover( function() { var $this = $(this), $subMenu = $this.children('.subMenu'); if( $subMenu.length ){ $this.addClass('hover').stop(); }else { if($this.parent().is($(':gt(1)', $mainMenu))){ $this.stop(false, true).fadeIn('slow'); } } if($this.parent().is($(':gt(1)', $mainMenu))){ $subMenu.stop(true, true).fadeIn(200,'easeInOutQuad'); $subMenu.css('left', $subMenu.parent().outerWidth(true)); }else{ $subMenu.stop(true, true).delay( 200 ).fadeIn(200,'easeInOutQuad'); } }, function() { var $this = $(this), $subMenu = $this.children('ul, div'); if($this.parent().is($(':gt(1)', $mainMenu))){ $this.children('ul').hide(); $this.children('ul').css('left', 0); }else{ $this.removeClass('hover'); $subMenu.stop(true, true).delay( 200 ).fadeOut(); } if( $subMenu.length ){$this.removeClass('hover');} }); } } jQuery(function($){ "use strict"; if($('#superSizedSlider').length){ $('#superSizedSlider').height($(window).height()); $.supersized({ // Functionality slideshow : 1, // Slideshow on/off autoplay : 1, // Slideshow starts playing automatically start_slide : 1, // Start slide (0 is random) stop_loop : 0, // Pauses slideshow on last slide random : 0, // Randomize slide order (Ignores start slide) slide_interval : 12000, // Length between transitions transition : 1, // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left transition_speed : 1000, // Speed of transition new_window : 1, // Image links open in new window/tab pause_hover : 0, // Pause slideshow on hover keyboard_nav : 1, // Keyboard navigation on/off performance : 1, // 0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit) image_protect : 1, // Disables image dragging and right click with Javascript // Size & Position min_width : 0, // Min width allowed (in pixels) min_height : 0, // Min height allowed (in pixels) vertical_center : 1, // Vertically center background horizontal_center : 1, // Horizontally center background fit_always : 0, // Image will never exceed browser width or height (Ignores min. dimensions) fit_portrait : 1, // Portrait images will not exceed browser height fit_landscape : 0, // Landscape images will not exceed browser width // Components slide_links : 'blank', // Individual links for each slide (Options: false, 'num', 'name', 'blank') thumb_links : 0, // Individual thumb links for each slide thumbnail_navigation : 0, // Thumbnail navigation slides : [ // Slideshow Images {image : './images/slider/super/supersized-1.jpg', title : '

We are a creative agency

learn more', thumb : '', url : ''}, {image : './images/slider/super/supersized-2.jpg', title : '

We build beautiful websites

check our portfolio', thumb : '', url : ''}, {image : './images/slider/super/supersized-3.jpg', title : '

That\'s how we like it

call us', thumb : '', url : ''} ], // Theme Options progress_bar : 0, // Timer for each slide mouse_scrub : 0 }); } }); /* TO TOP BUTTON */ function toTop(mobile){ if(mobile == false){ if(!$('#nekoToTop').length) $('body').append(''); $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('#nekoToTop').slideDown('fast'); } else { $('#nekoToTop').slideUp('fast'); } }); $('#nekoToTop').click(function (e) { e.preventDefault(); $("html, body").animate({ scrollTop: 0 }, 800, 'easeInOutCirc'); }); }else{ if($('#nekoToTop').length) $('#nekoToTop').remove(); } }