init.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. new WOW().init();
  2. jQuery(document).ready(function($) {
  3. $(window).bind('load', function() {
  4. $('#loader').fadeOut(700);
  5. });
  6. /*============================================
  7. Welcome Cookies
  8. ==============================================*/
  9. $(function dw_set_cookie() {
  10. var COOKIE = 'windhamdavid-cookie';
  11. var dwcookie = $.cookie(COOKIE);
  12. if (dwcookie == null) {
  13. $.cookie(COOKIE, 'yum-cookies', { expires: 7, path: '/'});
  14. $('.welcome').typed({
  15. 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'],
  16. typeSpeed: -40,
  17. backSpeed: -70,
  18. startDelay: 0,
  19. backDelay: 0,
  20. loop: false,
  21. loopCount: false,
  22. attr: null,
  23. callback: function(){
  24. dw_shift();
  25. }
  26. });
  27. }
  28. else {
  29. $('.intro').collapse('hide');
  30. $('.terminal').modal('show');
  31. $('.welcome-back').typed({
  32. strings: ['Hey...', 'Welcome back...'],
  33. typeSpeed: -40,
  34. backSpeed: -70,
  35. startDelay: 0,
  36. backDelay: 0,
  37. loop: false,
  38. loopCount: false,
  39. attr: null,
  40. callback: function(){
  41. dw_collapse();
  42. }
  43. });
  44. }
  45. });
  46. function dw_shift() {
  47. var collapseh = $('.intro').height();
  48. $('.leader').ScrollTo({
  49. offset: -(collapseh),
  50. duration: 1500,
  51. easing: 'linear',
  52. callback: function(){
  53. dw_collapse();
  54. }
  55. });
  56. $('.intro').slideToggle({
  57. duration: 1000,
  58. easing: 'linear'
  59. });
  60. }
  61. function dw_collapse() {
  62. //$('.intro').collapse('hide');
  63. $('.terminal').modal('hide');
  64. }
  65. /*============================================
  66. Navigation
  67. ==============================================*/
  68. $('.nav-toggle').on('touchstart click', function(e) {
  69. e.preventDefault();
  70. $( this ).toggleClass( 'active' );
  71. });
  72. $('#nav').affix({
  73. offset: {top: $('.intro').height()-$('.navbar').height()}
  74. });
  75. $(function dw_hidenav() {
  76. var headerHeight = $('.navbar').height();
  77. $(window).on('scroll', { previousTop: 0 },
  78. function() {
  79. var currentTop = $(window).scrollTop();
  80. if (currentTop < this.previousTop) {
  81. if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
  82. $('.navbar').addClass('visible');
  83. } else {
  84. $('.navbar').removeClass('visible fixed');
  85. }
  86. }
  87. else {
  88. $('.navbar').removeClass('visible');
  89. if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
  90. }
  91. this.previousTop = currentTop;
  92. }
  93. );
  94. });
  95. /*============================================
  96. Carousel
  97. ==============================================*/
  98. $('.carousel').carousel({
  99. interval: 4200
  100. });
  101. $('.carousel').on('slide.bs.carousel', function() {
  102. $('.carousel-caption').fadeIn(600);
  103. //$('#tv').removeClass('invert');
  104. });
  105. $('.carousel').on('slid.bs.carousel', function() {
  106. $('.carousel-caption').fadeOut(600);
  107. //$('#tv').addClass('invert');
  108. });
  109. /*============================================
  110. Comments
  111. ==============================================*/
  112. $('#comments').hide();
  113. $('.toggle-comments').on('touchstart click', function(e) {
  114. e.preventDefault();
  115. $('#comments').toggle('slow', function() {
  116. var anchor = $('.toggle-comments');
  117. var anchorText = anchor.text() === 'Hide Comments' ? 'Show Comments' : 'Hide Comments';
  118. $(anchor).text(anchorText);
  119. });
  120. });
  121. $('#commentform').validate({
  122. rules: {
  123. author: {
  124. required: true,
  125. minlength: 2
  126. },
  127. email: {
  128. required: true,
  129. email: true
  130. },
  131. comment: {
  132. required: true,
  133. minlength: 20
  134. }
  135. },
  136. messages: {
  137. author: "Please enter in your name.",
  138. email: "Please enter a valid email address.",
  139. comment: "Message box can't be empty!"
  140. },
  141. errorElement: "div",
  142. errorPlacement: function(error, element) {
  143. element.before(error);
  144. }
  145. });
  146. /*============================================
  147. SmoothState
  148. ==============================================*/
  149. /*============================================
  150. Calendar
  151. ==============================================*/
  152. $('.calendar').fullCalendar ({
  153. firstDay : 1,
  154. height: 345,
  155. events: [
  156. {
  157. title: 'Project',
  158. start: '2014-09-27',
  159. end: '2014-10-02'
  160. },
  161. {
  162. title: 'Conf',
  163. start: '2014-10-11',
  164. end: '2014-10-13',
  165. borderColor: 'red'
  166. },
  167. {
  168. title: 'off',
  169. start: '2014-10-13',
  170. end: '2014-10-16'
  171. },
  172. {
  173. title: 'Contract',
  174. start: '2014-10-16',
  175. end: '2014-10-31'
  176. },
  177. {
  178. title: 'Contract',
  179. start: '2014-11-03',
  180. end: '2014-11-22'
  181. },
  182. {
  183. title: 'Project',
  184. start: '2014-12-01',
  185. end: '2014-12-06'
  186. },
  187. {
  188. title: 'Project',
  189. start: '2014-12-08',
  190. end: '2014-12-13'
  191. },
  192. {
  193. title: 'Holiday',
  194. start: '2014-12-22',
  195. end: '2015-01-05',
  196. borderColor: 'red'
  197. },
  198. {
  199. title: 'Project',
  200. start: '2015-01-06',
  201. end: '2015-01-25'
  202. },
  203. {
  204. title: 'Project',
  205. start: '2015-02-02',
  206. end: '2015-02-14'
  207. },
  208. {
  209. title: 'Holiday',
  210. start: '2015-02-14',
  211. end: '2015-02-19',
  212. borderColor: 'red'
  213. }
  214. ]
  215. });
  216. });