/*----------------------------------------------------------------------------------- /* /* Init JS /* -----------------------------------------------------------------------------------*/ jQuery(document).ready(function($) { /*----------------------------------------------------*/ /* Typed Header ------------------------------------------------------ */ var typed = new Typed('#header-hi-text', { strings: ["Hi, I'm Dennis "], typeSpeed: 45, startDelay: 200, onComplete: function() { $('#header-eng-div p').addClass('load'); setTimeout(function() { $('.social').addClass('load'); }, 1000); setTimeout(function() { $('.icon-down-circle').addClass('load'); }, 1000); } }); /*----------------------------------------------------*/ /* FitText Settings ------------------------------------------------------ */ setTimeout(function() { $('h1.responsive-headline').fitText(1, { minFontSize: '30px', maxFontSize: '75px' }); $('h3.responsive-headline').fitText(1, { minFontSize: '8px', maxFontSize: '20px' }); }, 100); /*----------------------------------------------------*/ /* Smooth Scrolling ------------------------------------------------------ */ $('.smoothscroll').on('click',function (e) { e.preventDefault(); var target = this.hash, $target = $(target); $('html, body').stop().animate({ 'scrollTop': $target.offset().top }, 800, 'swing', function () { window.location.hash = target; }); }); /*----------------------------------------------------*/ /* Highlight the current section in the navigation bar ------------------------------------------------------*/ var sections = $("section"); var navigation_links = $("#nav-wrap a"); sections.waypoint({ handler: function(event, direction) { var active_section; active_section = $(this); if (direction === "up") active_section = active_section.prev(); var active_link = $('#nav-wrap a[href="#' + active_section.attr("id") + '"]'); navigation_links.parent().removeClass("current"); active_link.parent().addClass("current"); }, offset: '35%' }); /*----------------------------------------------------*/ /* Make sure that #header-background-image height is /* equal to the browser height. ------------------------------------------------------ */ $('header').css({ 'height': $(window).height() }); $(window).on('resize', function() { $('header').css({ 'height': $(window).height() }); $('body').css({ 'width': $(window).width() }) }); /*----------------------------------------------------*/ /* Fade In/Out Primary Navigation ------------------------------------------------------*/ $(window).on('scroll', function() { var h = $('header').height(); var y = $(window).scrollTop(); var nav = $('#nav-wrap'); if ( (y > h*.20) && (y < h) && ($(window).outerWidth() > 768 ) ) { nav.fadeOut('fast'); } else { if (y < h*.20) { nav.removeClass('opaque').fadeIn('fast'); } else { nav.addClass('opaque').fadeIn('fast'); } } }); /*----------------------------------------------------*/ /* Modal Popup ------------------------------------------------------*/ $('.item-wrap a').magnificPopup({ type:'inline', fixedContentPos: false, removalDelay: 200, showCloseBtn: false, mainClass: 'mfp-fade' }); $(document).on('click', '.popup-modal-dismiss', function (e) { e.preventDefault(); $.magnificPopup.close(); }); /*----------------------------------------------------*/ /* Flexslider /*----------------------------------------------------*/ $('.flexslider').flexslider({ namespace: "flex-", controlsContainer: ".flex-container", animation: 'slide', controlNav: true, directionNav: false, smoothHeight: true, slideshowSpeed: 7000, animationSpeed: 600, randomize: false, }); /*----------------------------------------------------*/ /* contact ------------------------------------------------------*/ // Adapt Riot logo to format of fontawesome icons var faHeight = document.getElementById('contact-fa').clientHeight * 1.3; document.getElementById('contact-riot-logo').setAttribute("style","height:"+faHeight+"px; width:"+faHeight+"px"); });