init.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. new WOW().init();
  2. jQuery(document).ready(function($) {
  3. $(window).bind("load", function () {
  4. $('#loader').fadeOut(700);
  5. });
  6. $(function(){
  7. $(".typed").typed({
  8. 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"],
  9. typeSpeed: -40,
  10. backSpeed: -70,
  11. startDelay: 0,
  12. backDelay: 0,
  13. loop: false,
  14. loopCount: false,
  15. attr: null,
  16. callback: function(){
  17. shift();
  18. }
  19. });
  20. });
  21. function shift(){
  22. $('.leader').ScrollTo({
  23. duration: 1500,
  24. easing: 'linear',
  25. durationMode: 'all',
  26. callback: function(){
  27. thecollapse();
  28. }
  29. });
  30. }
  31. function thecollapse(){
  32. //$('.intro').collapse('hide')
  33. }
  34. $('#nav').affix({
  35. offset: {top: $('.intro').height()-$('#nav').height()}
  36. });
  37. $('.nav-toggle').on( 'click', function() {
  38. $( this ).toggleClass( 'active' );
  39. });
  40. ;(function ($) {
  41. 'use strict';
  42. var content = $('.transit').smoothState({
  43. onStart : {
  44. duration: 250,
  45. render: function () {
  46. content.toggleAnimationClass('is-exiting');
  47. }
  48. }
  49. }).data('smoothState');
  50. })(jQuery);
  51. var headerHeight = $('.navbar').height();
  52. $(window).on('scroll', { previousTop: 0 },
  53. function() {
  54. var currentTop = $(window).scrollTop();
  55. if (currentTop < this.previousTop) {
  56. if (currentTop > 0 && $('.navbar').hasClass('fixed')) {
  57. $('.navbar').addClass('visible');
  58. } else {
  59. $('.navbar').removeClass('visible fixed');
  60. }
  61. } else {
  62. $('.navbar').removeClass('visible');
  63. if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed');
  64. }
  65. this.previousTop = currentTop;
  66. });
  67. var commentsDiv = $('#comments');
  68. if (commentsDiv.length) {
  69. $(commentsDiv).hide();
  70. $('.toggle-comments').on('click', function(e) {
  71. e.preventDefault();
  72. $(commentsDiv).toggle('slow', function() {
  73. var anchor = $('.toggle-comments');
  74. var anchorText = anchor.text() === 'Hide Comments' ? 'Show Comments' : 'Hide Comments';
  75. $(anchor).text(anchorText);
  76. });
  77. });
  78. }
  79. });
  80. ;(function ($) {
  81. 'use strict';
  82. var $body = $('html, body'),
  83. content = $('#big-top').smoothState({
  84. prefetch: true,
  85. pageCacheSize: 4,
  86. onStart: {
  87. duration: 250,
  88. render: function (url, $container) {
  89. content.toggleAnimationClass('is-exiting');
  90. $body.animate({
  91. scrollTop: 0
  92. });
  93. }
  94. }
  95. }).data('smoothState');
  96. })(jQuery);