Açıklama Yok

main.js 9.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. ;(function () {
  2. 'use strict';
  3. var isMobile = {
  4. Android: function() {
  5. return navigator.userAgent.match(/Android/i);
  6. },
  7. BlackBerry: function() {
  8. return navigator.userAgent.match(/BlackBerry/i);
  9. },
  10. iOS: function() {
  11. return navigator.userAgent.match(/iPhone|iPad|iPod/i);
  12. },
  13. Opera: function() {
  14. return navigator.userAgent.match(/Opera Mini/i);
  15. },
  16. Windows: function() {
  17. return navigator.userAgent.match(/IEMobile/i);
  18. },
  19. any: function() {
  20. return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
  21. }
  22. };
  23. // iPad and iPod detection
  24. var isiPad = function(){
  25. return (navigator.platform.indexOf("iPad") != -1);
  26. };
  27. var isiPhone = function(){
  28. return (
  29. (navigator.platform.indexOf("iPhone") != -1) ||
  30. (navigator.platform.indexOf("iPod") != -1)
  31. );
  32. };
  33. var fullHeight = function() {
  34. if ( !isMobile.any() ) {
  35. $('.js-fullheight').css('height', $(window).height());
  36. $(window).resize(function(){
  37. $('.js-fullheight').css('height', $(window).height());
  38. });
  39. }
  40. };
  41. // Parallax
  42. var parallax = function() {
  43. if ( !isMobile.any() ) {
  44. $(window).stellar();
  45. }
  46. };
  47. // Page Nav
  48. var clickMenu = function() {
  49. $('#navbar a:not([class="external"])').click(function(event){
  50. var section = $(this).data('nav-section'),
  51. navbar = $('#navbar');
  52. if ( $('[data-section="' + section + '"]').length ) {
  53. $('html, body').animate({
  54. scrollTop: $('[data-section="' + section + '"]').offset().top - 0
  55. }, 500);
  56. }
  57. if ( navbar.is(':visible')) {
  58. navbar.removeClass('in');
  59. navbar.attr('aria-expanded', 'false');
  60. $('.js-fh5co-nav-toggle').removeClass('active');
  61. }
  62. event.preventDefault();
  63. return false;
  64. });
  65. };
  66. // Reflect scrolling in navigation
  67. var navActive = function(section) {
  68. var $el = $('#navbar > ul');
  69. $el.find('li').removeClass('active');
  70. $el.each(function(){
  71. $(this).find('a[data-nav-section="'+section+'"]').closest('li').addClass('active');
  72. });
  73. };
  74. var navigationSection = function() {
  75. var $section = $('section[data-section]');
  76. $section.waypoint(function(direction) {
  77. if (direction === 'down') {
  78. navActive($(this.element).data('section'));
  79. }
  80. }, {
  81. offset: '150px'
  82. });
  83. $section.waypoint(function(direction) {
  84. if (direction === 'up') {
  85. navActive($(this.element).data('section'));
  86. }
  87. }, {
  88. offset: function() { return -$(this.element).height() + 155; }
  89. });
  90. };
  91. // Window Scroll
  92. var windowScroll = function() {
  93. var lastScrollTop = 0;
  94. $(window).scroll(function(event){
  95. var header = $('#fh5co-header'),
  96. scrlTop = $(this).scrollTop();
  97. if ( scrlTop > 500 && scrlTop <= 2000 ) {
  98. header.addClass('navbar-fixed-top fh5co-animated slideInDown');
  99. } else if ( scrlTop <= 500) {
  100. if ( header.hasClass('navbar-fixed-top') ) {
  101. header.addClass('navbar-fixed-top fh5co-animated slideOutUp');
  102. setTimeout(function(){
  103. header.removeClass('navbar-fixed-top fh5co-animated slideInDown slideOutUp');
  104. }, 100 );
  105. }
  106. }
  107. });
  108. };
  109. // Animations
  110. // Home
  111. var homeAnimate = function() {
  112. if ( $('#fh5co-home').length > 0 ) {
  113. $('#fh5co-home').waypoint( function( direction ) {
  114. if( direction === 'down' && !$(this.element).hasClass('animated') ) {
  115. setTimeout(function() {
  116. $('#fh5co-home .to-animate').each(function( k ) {
  117. var el = $(this);
  118. setTimeout ( function () {
  119. el.addClass('fadeInUp animated');
  120. }, k * 200, 'easeInOutExpo' );
  121. });
  122. }, 200);
  123. $(this.element).addClass('animated');
  124. }
  125. } , { offset: '80%' } );
  126. }
  127. };
  128. var exploreAnimate = function() {
  129. var explore = $('#fh5co-explore');
  130. if ( explore.length > 0 ) {
  131. explore.waypoint( function( direction ) {
  132. if( direction === 'down' && !$(this.element).hasClass('animated') ) {
  133. setTimeout(function() {
  134. explore.find('.to-animate').each(function( k ) {
  135. var el = $(this);
  136. setTimeout ( function () {
  137. el.addClass('fadeInUp animated');
  138. }, k * 200, 'easeInOutExpo' );
  139. });
  140. }, 200);
  141. setTimeout(function() {
  142. explore.find('.to-animate-2').each(function( k ) {
  143. var el = $(this);
  144. setTimeout ( function () {
  145. el.addClass('bounceIn animated');
  146. }, k * 200, 'easeInOutExpo' );
  147. });
  148. }, 700);
  149. setTimeout(function() {
  150. explore.find('.to-animate-3').each(function( k ) {
  151. var el = $(this);
  152. setTimeout ( function () {
  153. el.addClass('fadeInRight animated');
  154. }, k * 200, 'easeInOutExpo' );
  155. });
  156. }, 1000);
  157. $(this.element).addClass('animated');
  158. }
  159. } , { offset: '80%' } );
  160. }
  161. };
  162. var gettingStartedAnimate = function() {
  163. var started = $('.getting-started-1');
  164. if ( started.length > 0 ) {
  165. started.waypoint( function( direction ) {
  166. if( direction === 'down' && !$(this.element).hasClass('animated') ) {
  167. setTimeout(function() {
  168. started.find('.to-animate').each(function( k ) {
  169. var el = $(this);
  170. setTimeout ( function () {
  171. el.addClass('fadeInUp animated');
  172. }, k * 200, 'easeInOutExpo' );
  173. });
  174. }, 200);
  175. setTimeout(function() {
  176. started.find('.to-animate-2').each(function( k ) {
  177. var el = $(this);
  178. setTimeout ( function () {
  179. el.addClass('fadeInRight animated');
  180. }, k * 200, 'easeInOutExpo' );
  181. });
  182. }, 200);
  183. $(this.element).addClass('animated');
  184. }
  185. } , { offset: '80%' } );
  186. }
  187. };
  188. var pricingAnimate = function() {
  189. var pricing = $('#fh5co-pricing');
  190. if ( pricing.length > 0 ) {
  191. pricing.waypoint( function( direction ) {
  192. if( direction === 'down' && !$(this.element).hasClass('animated') ) {
  193. setTimeout(function() {
  194. pricing.find('.to-animate').each(function( k ) {
  195. var el = $(this);
  196. setTimeout ( function () {
  197. el.addClass('fadeIn animated');
  198. }, k * 200, 'easeInOutExpo' );
  199. });
  200. }, 200);
  201. setTimeout(function() {
  202. pricing.find('.to-animate-2').each(function( k ) {
  203. var el = $(this);
  204. setTimeout ( function () {
  205. el.addClass('fadeInUp animated');
  206. }, k * 200, 'easeInOutExpo' );
  207. });
  208. }, 200);
  209. $(this.element).addClass('animated');
  210. }
  211. } , { offset: '80%' } );
  212. }
  213. };
  214. var servicesAnimate = function() {
  215. var services = $('#fh5co-services');
  216. if ( services.length > 0 ) {
  217. services.waypoint( function( direction ) {
  218. if( direction === 'down' && !$(this.element).hasClass('animated') ) {
  219. var sec = services.find('.to-animate').length,
  220. sec = parseInt((sec * 200) + 400);
  221. setTimeout(function() {
  222. services.find('.to-animate').each(function( k ) {
  223. var el = $(this);
  224. setTimeout ( function () {
  225. el.addClass('fadeInUp animated');
  226. }, k * 200, 'easeInOutExpo' );
  227. });
  228. }, 200);
  229. setTimeout(function() {
  230. services.find('.to-animate-2').each(function( k ) {
  231. var el = $(this);
  232. setTimeout ( function () {
  233. el.addClass('bounceIn animated');
  234. }, k * 200, 'easeInOutExpo' );
  235. });
  236. }, sec);
  237. $(this.element).addClass('animated');
  238. }
  239. } , { offset: '80%' } );
  240. }
  241. };
  242. var teamAnimate = function() {
  243. var team = $('#fh5co-team');
  244. if ( team.length > 0 ) {
  245. team.waypoint( function( direction ) {
  246. if( direction === 'down' && !$(this.element).hasClass('animated') ) {
  247. var sec = team.find('.to-animate').length,
  248. sec = parseInt((sec * 200) + 400);
  249. setTimeout(function() {
  250. team.find('.to-animate').each(function( k ) {
  251. var el = $(this);
  252. setTimeout ( function () {
  253. el.addClass('fadeIn animated');
  254. }, k * 200, 'easeInOutExpo' );
  255. });
  256. }, 200);
  257. setTimeout(function() {
  258. team.find('.to-animate-2').each(function( k ) {
  259. var el = $(this);
  260. setTimeout ( function () {
  261. el.addClass('fadeInUp animated');
  262. }, k * 200, 'easeInOutExpo' );
  263. });
  264. }, sec);
  265. $(this.element).addClass('animated');
  266. }
  267. } , { offset: '80%' } );
  268. }
  269. };
  270. var footerAnimate = function() {
  271. var footer = $('#fh5co-footer');
  272. if ( footer.length > 0 ) {
  273. footer.waypoint( function( direction ) {
  274. if( direction === 'down' && !$(this.element).hasClass('animated') ) {
  275. setTimeout(function() {
  276. footer.find('.to-animate').each(function( k ) {
  277. var el = $(this);
  278. setTimeout ( function () {
  279. el.addClass('fadeIn animated');
  280. }, k * 200, 'easeInOutExpo' );
  281. });
  282. }, 200);
  283. $(this.element).addClass('animated');
  284. }
  285. } , { offset: '80%' } );
  286. }
  287. };
  288. var counter = function() {
  289. $('.js-counter').countTo({
  290. formatter: function (value, options) {
  291. return value.toFixed(options.decimals);
  292. },
  293. });
  294. };
  295. var counterWayPoint = function() {
  296. if ($('#fh5co-counter-section').length > 0 ) {
  297. $('#fh5co-counter-section').waypoint( function( direction ) {
  298. if( direction === 'down' && !$(this.element).hasClass('animated') ) {
  299. setTimeout( counter , 400);
  300. $(this.element).addClass('animated');
  301. }
  302. } , { offset: '90%' } );
  303. }
  304. };
  305. // Document on load.
  306. $(function(){
  307. parallax();
  308. fullHeight();
  309. clickMenu();
  310. windowScroll();
  311. navigationSection();
  312. // Animations
  313. homeAnimate();
  314. exploreAnimate();
  315. gettingStartedAnimate();
  316. pricingAnimate();
  317. servicesAnimate();
  318. teamAnimate();
  319. footerAnimate();
  320. counter();
  321. counterWayPoint();
  322. });
  323. }());