custom.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. $(window).load(function() {
  2. 'use strict';
  3. $(".pageloader").delay(1000).fadeOut("slow");
  4. InitcssFix();
  5. });
  6. jQuery( document ).ready(function($) {
  7. 'use strict';
  8. InitcssFix();
  9. /* ===================
  10. Animated Items
  11. =================== */
  12. $('.animated').appear(function() {
  13. var elem = $(this);
  14. var animation = elem.data('animation');
  15. if ( !elem.hasClass('visible') ) {
  16. var animationDelay = elem.data('animation-delay');
  17. if ( animationDelay ) {
  18. setTimeout(function(){
  19. elem.addClass( animation + " visible" );
  20. }, animationDelay);
  21. } else {
  22. elem.addClass( animation + " visible" );
  23. }
  24. }
  25. });
  26. /* =============================
  27. Carousel Slider
  28. ============================= */
  29. $("#app-screenshot").owlCarousel({
  30. items : 3,
  31. lazyLoad : true,
  32. autoPlay: false,
  33. navigation : true,
  34. navigationText: ['<i class="fa fa-chevron-left color-grey"></i>','<i class="fa fa-chevron-right color-grey"></i>'],
  35. pagination: false,
  36. itemsCustom : false,
  37. itemsDesktop : [1199, 3],
  38. itemsDesktopSmall : [980, 3],
  39. itemsTablet : [768, 2],
  40. itemsTabletSmall : false,
  41. itemsMobile : [479, 1]
  42. });
  43. /* =============================
  44. Services Carousel Slider
  45. ============================= */
  46. $("#awesome-services").owlCarousel({
  47. items : 3,
  48. lazyLoad : true,
  49. autoPlay: true,
  50. navigation : false,
  51. pagination: false,
  52. itemsCustom : false,
  53. itemsDesktop : [1199, 3],
  54. itemsDesktopSmall : [980, 3],
  55. itemsTablet : [768, 2],
  56. itemsTabletSmall : false,
  57. itemsMobile : [480, 1]
  58. });
  59. /* ===================
  60. Scroll Navigation
  61. =================== */
  62. $('.scroll').bind('click', function(event) {
  63. var $anchor = $(this);
  64. $('html, body').stop().animate({
  65. scrollTop : $($anchor.attr('href')).offset().top + 2 + "px"
  66. }, 1200, 'easeInOutExpo');
  67. event.preventDefault();
  68. return false;
  69. });
  70. // Menus hide after click on mobile devices
  71. $('.nav li a').click(function () {
  72. $('.navbar-collapse').removeClass('in');
  73. return false;
  74. });
  75. /* ===================
  76. Fixed Menu on Scroll
  77. =================== */
  78. $("#sticky-menu").sticky({topSpacing:0});
  79. /* =============================
  80. Active Scrollspy Navigation
  81. ============================= */
  82. $('body').scrollspy({
  83. target: '#topnav',
  84. offset: 95
  85. });
  86. /* =============================
  87. Contact Form Validation
  88. ============================= */
  89. $('#contactform').bootstrapValidator({
  90. message: '',
  91. feedbackIcons: {
  92. valid: 'fa fa-check',
  93. invalid: 'fa fa-times',
  94. validating: 'fa fa-refresh'
  95. },
  96. fields: {
  97. contact_name: {
  98. validators: {
  99. notEmpty: {
  100. message: ''
  101. }
  102. }
  103. },
  104. contact_email: {
  105. validators: {
  106. notEmpty: {
  107. message: ''
  108. },
  109. emailAddress: {
  110. message: ''
  111. }
  112. }
  113. },
  114. contact_message: {
  115. validators: {
  116. notEmpty: {
  117. message: ''
  118. }
  119. }
  120. }
  121. },
  122. submitHandler: function(validator, form, submitButton) {
  123. var data = $('#contactform').serialize();
  124. $.ajax({
  125. type: "POST",
  126. url: "process.php",
  127. data: $('#contactform').serialize(),
  128. success: function(msg){
  129. $('.gk-form-message').html(msg);
  130. $('.gk-form-message').show();
  131. submitButton.removeAttr("disabled");
  132. resetForm($('#contactform'));
  133. },
  134. error: function(msg){
  135. $('.gk-form-message').html(msg);
  136. $('.gk-form-message').show();
  137. submitButton.removeAttr("disabled");
  138. resetForm($('#contactform'));
  139. }
  140. });
  141. return false;
  142. },
  143. });
  144. $('#subscribe').bootstrapValidator({
  145. message: '',
  146. feedbackIcons: {
  147. valid: 'fa fa-check',
  148. invalid: 'fa fa-times',
  149. validating: 'fa fa-refresh'
  150. },
  151. fields: {
  152. subscribe_email: {
  153. validators: {
  154. notEmpty: {
  155. message: ''
  156. }
  157. }
  158. }
  159. },
  160. submitHandler: function(validator, form, submitButton) {
  161. var data = $('#subscribe').serialize();
  162. $.ajax({
  163. type: "POST",
  164. url: "subscribe.php",
  165. data: $('#subscribe').serialize(),
  166. success: function(msg){
  167. $('.gk-form-message-subscribe').html(msg);
  168. $('.gk-form-message-subscribe').show();
  169. submitButton.removeAttr("disabled");
  170. resetForm($('#subscribe'));
  171. },
  172. error: function(msg){
  173. $('.gk-form-message-subscribe').html(msg);
  174. $('.gk-form-message-subscribe').show();
  175. submitButton.removeAttr("disabled");
  176. resetForm($('#subscribe'));
  177. }
  178. });
  179. return false;
  180. },
  181. });
  182. function resetForm($form) {
  183. $form.find('input:text, input:password, input, input:file, select, textarea').val('');
  184. $form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');
  185. $form.find('input:text, input:password, input, input:file, select, textarea, input:radio, input:checkbox').parent().find('.form-control-feedback').hide();
  186. }
  187. /* =============================
  188. Color Panel
  189. ============================= */
  190. // Theme Panel Open/Close
  191. $( "#theme-panel .panel-button" ).click(function(){
  192. $( "#theme-panel" ).toggleClass( "close-theme-panel", "open-theme-panel", 1000 );
  193. $( "#theme-panel" ).toggleClass( "open-theme-panel", "close-theme-panel", 1000 );
  194. return false;
  195. });
  196. /* =============================
  197. Count Section
  198. ============================= */
  199. $(".count-number").appear(function(){
  200. $(this).each(function(){
  201. var datacount = $(this).attr('data-count');
  202. $(this).find('.counter').delay(6000).countTo({
  203. from: 10,
  204. to: datacount,
  205. speed: 3000,
  206. refreshInterval: 50,
  207. });
  208. });
  209. });
  210. /* ===================
  211. Video Script
  212. =================== */
  213. $(".player").mb_YTPlayer();
  214. });
  215. $(window).resize(function() {
  216. 'use strict';
  217. InitcssFix();
  218. });
  219. /* ===============================
  220. CSS Fix for Background Shapes
  221. =============================== */
  222. function InitcssFix() {
  223. var width = $(window).width();
  224. if( width >= 1480 && width < 1600 ) {
  225. $('.wrapper-class').addClass('after-1500');
  226. $('.wrapper-class').removeClass('after-1600');
  227. } else if( width >= 1600 && width < 1800 ) {
  228. $('.wrapper-class').addClass('after-1600');
  229. $('.wrapper-class').removeClass('after-1500');
  230. $('.wrapper-class').removeClass('after-2000');
  231. } else if( width >= 1800 && width < 2000 ) {
  232. $('.wrapper-class').addClass('after-1800');
  233. $('.wrapper-class').removeClass('after-1600');
  234. $('.wrapper-class').removeClass('after-2000');
  235. } else if( width >= 2000 && width < 2600 ) {
  236. $('.wrapper-class').addClass('after-2000');
  237. $('.wrapper-class').removeClass('after-1600');
  238. $('.wrapper-class').removeClass('after-1800');
  239. $('.wrapper-class').removeClass('after-2600');
  240. } else if( width >= 2600 && width < 3000 ) {
  241. $('.wrapper-class').addClass('after-2600');
  242. $('.wrapper-class').removeClass('after-2000');
  243. $('.wrapper-class').removeClass('after-3000');
  244. } else if( width >= 3000 ) {
  245. $('.wrapper-class').addClass('after-3000');
  246. $('.wrapper-class').removeClass('after-2600');
  247. } else if( width <= 1480 ) {
  248. $('.wrapper-class').removeClass('after-1500');
  249. }
  250. }