new WOW().init(); jQuery(document).ready(function($) { $(window).bind('load', function() { $('#loader').fadeOut(700); }); /*============================================ Welcome Cookies ==============================================*/ $(function dw_set_cookie() { var COOKIE = 'windhamdavid-cookie'; var dwcookie = $.cookie(COOKIE); if (dwcookie == null) { $.cookie(COOKIE, 'yum-cookies', { expires: 7, path: '/'}); $('.welcome').typed({ strings: ['Hey,', 'Hello,\n^10Welcome to ^10my domain ^10...^10', 'Hello, \nWelcome to my little corner of the internet. \n^10It is nice to ', 'Hello, \nWelcome to my little corner of the internet. \nIt is very nice to have you here!^10\n'], typeSpeed: -40, backSpeed: -70, startDelay: 0, backDelay: 0, loop: false, loopCount: false, attr: null, callback: function(){ dw_shift(); } }); } else { $('.intro').collapse('hide'); $('.terminal').modal('show'); $('.welcome-back').typed({ strings: ['Hey...', 'Welcome back...'], typeSpeed: -40, backSpeed: -70, startDelay: 0, backDelay: 0, loop: false, loopCount: false, attr: null, callback: function(){ dw_collapse(); } }); } }); function dw_shift() { var collapseh = $('.intro').height(); $('.leader').ScrollTo({ offset: -(collapseh), duration: 1500, easing: 'linear', callback: function(){ dw_collapse(); } }); $('.intro').slideToggle({ duration: 1000, easing: 'linear' }); } function dw_collapse() { //$('.intro').collapse('hide'); $('.terminal').modal('hide'); } /*============================================ Navigation ==============================================*/ $('.nav-toggle').on('touchstart click', function(e) { e.preventDefault(); $( this ).toggleClass( 'active' ); }); $('#nav').affix({ offset: {top: $('.intro').height()-$('.navbar').height()} }); $(function dw_hidenav() { var headerHeight = $('.navbar').height(); $(window).on('scroll', { previousTop: 0 }, function() { var currentTop = $(window).scrollTop(); if (currentTop < this.previousTop) { if (currentTop > 0 && $('.navbar').hasClass('fixed')) { $('.navbar').addClass('visible'); } else { $('.navbar').removeClass('visible fixed'); } } else { $('.navbar').removeClass('visible'); if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed'); } this.previousTop = currentTop; } ); }); /*============================================ Carousel ==============================================*/ $('.carousel').carousel({ interval: 4200 }); $('.carousel').on('slide.bs.carousel', function() { $('.carousel-caption').fadeIn(600); //$('#tv').removeClass('invert'); }); $('.carousel').on('slid.bs.carousel', function() { $('.carousel-caption').fadeOut(600); //$('#tv').addClass('invert'); }); /*============================================ Comments ==============================================*/ $('#comments').hide(); $('.toggle-comments').on('touchstart click', function(e) { e.preventDefault(); $('#comments').toggle('slow', function() { var anchor = $('.toggle-comments'); var anchorText = anchor.text() === 'Hide Comments' ? 'Show Comments' : 'Hide Comments'; $(anchor).text(anchorText); }); }); $('#commentform').validate({ rules: { author: { required: true, minlength: 2 }, email: { required: true, email: true }, comment: { required: true, minlength: 20 } }, messages: { author: "Please enter in your name.", email: "Please enter a valid email address.", comment: "Message box can't be empty!" }, errorElement: "div", errorPlacement: function(error, element) { element.before(error); } }); /*============================================ SmoothState ==============================================*/ /*============================================ Calendar ==============================================*/ $('.calendar').fullCalendar ({ firstDay : 1, height: 345, events: [ { title: 'Project', start: '2014-09-27', end: '2014-10-02' }, { title: 'Conf', start: '2014-10-11', end: '2014-10-13', borderColor: 'red' }, { title: 'off', start: '2014-10-13', end: '2014-10-16' }, { title: 'Contract', start: '2014-10-16', end: '2014-10-31' }, { title: 'Contract', start: '2014-11-03', end: '2014-11-22' }, { title: 'Project', start: '2014-12-01', end: '2014-12-06' }, { title: 'Project', start: '2014-12-08', end: '2014-12-13' }, { title: 'Holiday', start: '2014-12-22', end: '2015-01-05', borderColor: 'red' }, { title: 'Project', start: '2015-01-06', end: '2015-01-25' }, { title: 'Project', start: '2015-02-02', end: '2015-02-14' }, { title: 'Holiday', start: '2015-02-14', end: '2015-02-19', borderColor: 'red' } ] }); });