main.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. jQuery(document).ready(function($) {
  2. $(window).scroll(function() {
  3. if ($(this).scrollTop() > 100) {
  4. $('.back-to-top').fadeIn('slow');
  5. } else {
  6. $('.back-to-top').fadeOut('slow');
  7. }
  8. });
  9. $('.back-to-top').click(function() {
  10. $('html, body').animate({
  11. scrollTop: 0
  12. }, 1500, 'easeInOutExpo');
  13. return false;
  14. });
  15. $("#header").sticky({
  16. topSpacing: 0,
  17. zIndex: '50'
  18. });
  19. $("#intro-carousel").owlCarousel({
  20. autoplay: true,
  21. dots: false,
  22. loop: true,
  23. animateOut: 'fadeOut',
  24. items: 1
  25. });
  26. new WOW().init();
  27. $('.nav-menu').superfish({
  28. animation: {
  29. opacity: 'show'
  30. },
  31. speed: 400
  32. });
  33. if ($('#nav-menu-container').length) {
  34. var $mobile_nav = $('#nav-menu-container').clone().prop({
  35. id: 'mobile-nav'
  36. });
  37. $mobile_nav.find('> ul').attr({
  38. 'class': '',
  39. 'id': ''
  40. });
  41. $('body').append($mobile_nav);
  42. $('body').prepend('<button type="button" id="mobile-nav-toggle"><i class="fa fa-bars"></i></button>');
  43. $('body').append('<div id="mobile-body-overly"></div>');
  44. $('#mobile-nav').find('.menu-has-children').prepend('<i class="fa fa-chevron-down"></i>');
  45. $(document).on('click', '.menu-has-children i', function(e) {
  46. $(this).next().toggleClass('menu-item-active');
  47. $(this).nextAll('ul').eq(0).slideToggle();
  48. $(this).toggleClass("fa-chevron-up fa-chevron-down");
  49. });
  50. $(document).on('click', '#mobile-nav-toggle', function(e) {
  51. $('body').toggleClass('mobile-nav-active');
  52. $('#mobile-nav-toggle i').toggleClass('fa-times fa-bars');
  53. $('#mobile-body-overly').toggle();
  54. });
  55. $(document).click(function(e) {
  56. var container = $("#mobile-nav, #mobile-nav-toggle");
  57. if (!container.is(e.target) && container.has(e.target).length === 0) {
  58. if ($('body').hasClass('mobile-nav-active')) {
  59. $('body').removeClass('mobile-nav-active');
  60. $('#mobile-nav-toggle i').toggleClass('fa-times fa-bars');
  61. $('#mobile-body-overly').fadeOut();
  62. }
  63. }
  64. });
  65. } else if ($("#mobile-nav, #mobile-nav-toggle").length) {
  66. $("#mobile-nav, #mobile-nav-toggle").hide();
  67. }
  68. $('.nav-menu a, #mobile-nav a, .scrollto').on('click', function() {
  69. if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
  70. var target = $(this.hash);
  71. if (target.length) {
  72. var top_space = 0;
  73. if ($('#header').length) {
  74. top_space = $('#header').outerHeight();
  75. if (!$('#header').hasClass('header-fixed')) {
  76. top_space = top_space - 20;
  77. }
  78. }
  79. $('html, body').animate({
  80. scrollTop: target.offset().top - top_space
  81. }, 1500, 'easeInOutExpo');
  82. if ($(this).parents('.nav-menu').length) {
  83. $('.nav-menu .menu-active').removeClass('menu-active');
  84. $(this).closest('li').addClass('menu-active');
  85. }
  86. if ($('body').hasClass('mobile-nav-active')) {
  87. $('body').removeClass('mobile-nav-active');
  88. $('#mobile-nav-toggle i').toggleClass('fa-times fa-bars');
  89. $('#mobile-body-overly').fadeOut();
  90. }
  91. return false;
  92. }
  93. }
  94. });
  95. $('.portfolio-popup').magnificPopup({
  96. type: 'image',
  97. removalDelay: 300,
  98. mainClass: 'mfp-fade',
  99. gallery: {
  100. enabled: true
  101. },
  102. zoom: {
  103. enabled: true,
  104. duration: 300,
  105. easing: 'ease-in-out',
  106. opener: function(openerElement) {
  107. return openerElement.is('img') ? openerElement : openerElement.find('img');
  108. }
  109. }
  110. });
  111. $(".testimonials-carousel").owlCarousel({
  112. autoplay: true,
  113. dots: true,
  114. loop: true,
  115. responsive: {
  116. 0: {
  117. items: 1
  118. },
  119. 768: {
  120. items: 2
  121. },
  122. 900: {
  123. items: 3
  124. }
  125. }
  126. });
  127. $(".clients-carousel").owlCarousel({
  128. autoplay: true,
  129. dots: true,
  130. loop: true,
  131. responsive: {
  132. 0: {
  133. items: 2
  134. },
  135. 768: {
  136. items: 4
  137. },
  138. 900: {
  139. items: 6
  140. }
  141. }
  142. });
  143. });