init.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. jQuery(document).ready(function($) {
  2. $(window).bind("load", function () {
  3. $('#loader').fadeOut(700);
  4. });
  5. $(function cookieset(){
  6. var COOKIE = 'windhamdavid-cookie';
  7. $go = $.cookie(COOKIE);
  8. if ($go == null) {
  9. $.cookie(COOKIE, 'yum-cookies', { expires: 7, path: '/', expires: 6 });
  10. $(".welcome").typed({
  11. strings: ["Hey,", "Hello,\n^10Welcome to ^10my domain ^10...^10", "Hello, \nWelcome to my little corner of the internet. \n^10It's nice to ", "Hello, \nWelcome to my little corner of the internet. \nIt's very nice to have you here!^10\n"],
  12. typeSpeed: -40,
  13. backSpeed: -70,
  14. startDelay: 0,
  15. backDelay: 0,
  16. loop: false,
  17. loopCount: false,
  18. attr: null,
  19. callback: function(){
  20. shift();
  21. }
  22. });
  23. }
  24. else {
  25. $('.intro').collapse('hide');
  26. $('.terminal').modal('show');
  27. $(".welcome-back").typed({
  28. strings: ["Hey...", "Welcome back..."],
  29. typeSpeed: -40,
  30. backSpeed: -70,
  31. startDelay: 0,
  32. backDelay: 0,
  33. loop: false,
  34. loopCount: false,
  35. attr: null,
  36. callback: function(){
  37. thecollapse();
  38. }
  39. });
  40. }
  41. });
  42. function shift(){
  43. $('.leader').ScrollTo({
  44. duration: 1500,
  45. easing: 'linear',
  46. durationMode: 'all',
  47. callback: function(){
  48. thecollapse();
  49. }
  50. });
  51. };
  52. function thecollapse(){
  53. $('.intro').collapse('hide')
  54. $('.terminal').modal('hide')
  55. };
  56. $('#nav').affix({
  57. offset: {top: $('.intro').height()-$('#nav').height()}
  58. });
  59. $('.nav-toggle').on( 'click', function() {
  60. $( this ).toggleClass( 'active' );
  61. });
  62. $('.carousel').carousel({
  63. interval: 4200
  64. });
  65. $('.carousel').on('slide.bs.carousel', function () {
  66. $('.carousel-caption').fadeIn(600)
  67. //$('#tv').removeClass('invert');
  68. })
  69. $('.carousel').on('slid.bs.carousel', function () {
  70. $('.carousel-caption').fadeOut(600)
  71. //$('#tv').addClass('invert');
  72. })
  73. $(function(){
  74. $('.calendar').fullCalendar ({
  75. firstDay : 1,
  76. height: 345,
  77. events: [
  78. {
  79. title: 'Project',
  80. start: '2014-09-27',
  81. end: '2014-10-02'
  82. },
  83. {
  84. title: 'Conf',
  85. start: '2014-10-11',
  86. end: '2014-10-13',
  87. borderColor: 'red'
  88. },
  89. {
  90. title: 'off',
  91. start: '2014-10-13',
  92. end: '2014-10-16'
  93. },
  94. {
  95. title: 'Contract',
  96. start: '2014-10-16',
  97. end: '2014-10-31'
  98. },
  99. {
  100. title: 'Contract',
  101. start: '2014-11-03',
  102. end: '2014-11-22'
  103. },
  104. {
  105. title: 'Project',
  106. start: '2014-12-01',
  107. end: '2014-12-06'
  108. },
  109. {
  110. title: 'Project',
  111. start: '2014-12-08',
  112. end: '2014-12-13'
  113. },
  114. {
  115. title: 'Holiday',
  116. start: '2014-12-22',
  117. end: '2015-01-05',
  118. borderColor: 'red'
  119. },
  120. {
  121. title: 'Project',
  122. start: '2015-01-06',
  123. end: '2015-01-25'
  124. },
  125. {
  126. title: 'Project',
  127. start: '2015-02-02',
  128. end: '2015-02-14'
  129. },
  130. {
  131. title: 'Holiday',
  132. start: '2015-02-14',
  133. end: '2015-02-19',
  134. borderColor: 'red'
  135. },
  136. ]
  137. })
  138. });
  139. ;(function ($) {
  140. 'use strict';
  141. var content = $('.transit').smoothState({
  142. onStart : {
  143. duration: 250,
  144. render: function () {
  145. content.toggleAnimationClass('is-exiting');
  146. }
  147. }
  148. }).data('smoothState');
  149. })(jQuery);
  150. var headerHeight = $('.navbar').height();
  151. $(window).on('scroll', { previousTop: 0 },
  152. function() {
  153. var currentTop = $(window).scrollTop();
  154. if (currentTop < this.previousTop) {
  155. if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
  156. $('.navbar').addClass('visible');
  157. } else {
  158. $('.navbar').removeClass('visible fixed');
  159. }
  160. } else {
  161. $('.navbar').removeClass('visible');
  162. if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
  163. }
  164. this.previousTop = currentTop;
  165. });
  166. var commentsDiv = $('#comments');
  167. if (commentsDiv.length) {
  168. $(commentsDiv).hide();
  169. $('.toggle-comments').on('click', function(e) {
  170. e.preventDefault();
  171. $(commentsDiv).toggle('slow', function() {
  172. var anchor = $('.toggle-comments');
  173. var anchorText = anchor.text() === 'Hide Comments' ? 'Show Comments' : 'Hide Comments';
  174. $(anchor).text(anchorText);
  175. });
  176. });
  177. }
  178. });
  179. ;(function ($) {
  180. 'use strict';
  181. var $body = $('html, body'),
  182. content = $('#big-top').smoothState({
  183. prefetch: true,
  184. pageCacheSize: 4,
  185. onStart: {
  186. duration: 250,
  187. render: function (url, $container) {
  188. content.toggleAnimationClass('is-exiting');
  189. $body.animate({
  190. scrollTop: 0
  191. });
  192. }
  193. }
  194. }).data('smoothState');
  195. })(jQuery);
  196. new WOW().init();