custom.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /*========================================================================
  2. EXCLUSIVE ON themeforest.net
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. Template Name : AppLite
  5. Author : mital_04
  6. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. Copyright (c) 2018 - mital_04
  8. ========================================================================*/
  9. (function($){
  10. "use strict"
  11. var LITE = {};
  12. /*--------------------
  13. * Pre Load
  14. ----------------------*/
  15. LITE.WebLoad = function(){
  16. document.getElementById("loading").style.display = "none";
  17. }
  18. /*--------------------
  19. * Header Class
  20. ----------------------*/
  21. LITE.HeaderSticky = function(){
  22. $(".navbar-toggler").on("click", function(a) {
  23. a.preventDefault(),
  24. $(".navbar").addClass("fixed-header")
  25. });
  26. }
  27. /*--------------------
  28. * Menu Close
  29. ----------------------*/
  30. LITE.MenuClose = function(){
  31. $('.navbar-nav .nav-link').on('click', function() {
  32. var toggle = $('.navbar-toggler').is(':visible');
  33. if (toggle) {
  34. $('.navbar-collapse').collapse('hide');
  35. }
  36. });
  37. }
  38. /*--------------------
  39. * Smooth Scroll
  40. ----------------------*/
  41. LITE.HeaderScroll = function(){
  42. $('header a[href*="#"]:not([href="#"])').on('click', function() {
  43. var PathName = location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') || location.hostname == this.hostname;
  44. if (PathName) {
  45. var target = $(this.hash);
  46. target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
  47. if (target.length) {
  48. $('html,body').animate({
  49. scrollTop: target.offset().top - 65,
  50. }, 1000);
  51. return false;
  52. }
  53. }
  54. });
  55. }
  56. /*--------------------
  57. * Header Fixed
  58. ----------------------*/
  59. LITE.HeaderFixed = function(){
  60. var varHeaderFix = $(window).scrollTop() >= 60;
  61. if (varHeaderFix) {
  62. $('.navbar').addClass('fixed-header');
  63. }
  64. else {
  65. $('.navbar').removeClass('fixed-header');
  66. }
  67. }
  68. /*--------------------
  69. * owl Slider
  70. ----------------------*/
  71. LITE.ClientSlider = function(){
  72. var testimonials_slider = $('#client-slider-single');
  73. testimonials_slider.owlCarousel({
  74. loop: true,
  75. margin: 0,
  76. nav:false,
  77. dots:true,
  78. responsive: {
  79. 0: {
  80. items: 1
  81. },
  82. 600: {
  83. items: 1
  84. },
  85. 768: {
  86. items: 2
  87. },
  88. 991: {
  89. items: 3
  90. },
  91. 1140: {
  92. items: 3
  93. }
  94. }
  95. });
  96. }
  97. LITE.WorkSlider = function(){
  98. var work_slider = $('#work-slider-single');
  99. work_slider.owlCarousel({
  100. loop: true,
  101. margin: 0,
  102. nav:false,
  103. dots:true,
  104. responsive: {
  105. 0: {
  106. items: 1
  107. },
  108. 600: {
  109. items: 1
  110. },
  111. 768: {
  112. items: 2
  113. },
  114. 991: {
  115. items: 3
  116. },
  117. 1140: {
  118. items: 3
  119. }
  120. }
  121. });
  122. }
  123. LITE.PopupVideo = function(){
  124. $('.popup-video').magnificPopup({
  125. disableOn: 700,
  126. type: 'iframe',
  127. mainClass: 'mfp-fade',
  128. removalDelay: 160,
  129. preloader: false,
  130. fixedContentPos: false
  131. });
  132. }
  133. LITE.LightboxGallery = function(){
  134. $('.portfolio-col').magnificPopup({
  135. delegate: '.lightbox-gallery',
  136. type: 'image',
  137. tLoading: '#%curr%',
  138. mainClass: 'mfp-fade',
  139. fixedContentPos: true,
  140. closeBtnInside: true,
  141. gallery: {
  142. enabled: true,
  143. navigateByImgClick: true,
  144. preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
  145. }
  146. });
  147. }
  148. /*--------------------
  149. * Progress Bar
  150. ----------------------*/
  151. LITE.ProgressBar = function(){
  152. $(".progress .progress-bar").each(function () {
  153. var bottom_object = $(this).offset().top + $(this).outerHeight();
  154. var bottom_window = $(window).scrollTop() + $(window).height();
  155. var progressWidth = $(this).attr('aria-valuenow') + '%';
  156. if(bottom_window > bottom_object) {
  157. $(this).css({
  158. width : progressWidth
  159. });
  160. }
  161. });
  162. }
  163. /*--------------------
  164. * Counter JS
  165. ----------------------*/
  166. var a = 0;
  167. LITE.Counter = function(){
  168. var oTop = $('.counter-box').offset().top - window.innerHeight;
  169. if (a == 0 && $(window).scrollTop() > oTop) {
  170. $('.count').each(function () {
  171. $(this).prop('Counter',0).animate({
  172. Counter: $(this).text()
  173. }, {
  174. duration: 4000,
  175. easing: 'swing',
  176. step: function (now) {
  177. $(this).text(Math.ceil(now));
  178. }
  179. });
  180. });
  181. a = 1;
  182. }
  183. }
  184. // Window on Load
  185. $(window).on("load", function(){
  186. LITE.WebLoad();
  187. });
  188. $(document).on("ready", function(){
  189. LITE.WorkSlider(),
  190. LITE.PopupVideo(),
  191. LITE.ClientSlider(),
  192. LITE.LightboxGallery(),
  193. LITE.MenuClose(),
  194. LITE.HeaderScroll(),
  195. LITE.Counter(),
  196. LITE.ProgressBar(),
  197. LITE.HeaderSticky();
  198. });
  199. $(window).on("scroll", function(){
  200. LITE.Counter(),
  201. LITE.ProgressBar(),
  202. LITE.HeaderFixed();
  203. });
  204. })(jQuery);