Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. /*
  2. ------------------------------------------------------------------------
  3. * Template Name : Carton - Responsive Multipurpose HTML5 Template *
  4. * Author : ThemesBoss *
  5. * Version : 1.0.0 *
  6. * Created : October 2018 *
  7. * File Description : Main Js file of the template *
  8. *-----------------------------------------------------------------------
  9. */
  10.  
  11. ! function($) {
  12. "use strict";
  13.  
  14. var Craton = function() {};
  15.  
  16. Craton.prototype.initStickyAddMenu = function() {
  17. $(window).on('scroll', function() {
  18. var scroll = $(window).scrollTop();
  19.  
  20. if (scroll >= 50) {
  21. $(".sticky").addClass("stickyadd");
  22. } else {
  23. $(".sticky").removeClass("stickyadd");
  24. }
  25. });
  26. },
  27.  
  28. Craton.prototype.initSmoothLink = function() {
  29. $('.nav-item a').on('click', function(event) {
  30. var $anchor = $(this);
  31. $('html, body').stop().animate({
  32. scrollTop: $($anchor.attr('href')).offset().top - 50
  33. }, 1500, 'easeInOutExpo');
  34. event.preventDefault();
  35. });
  36. },
  37.  
  38. Craton.prototype.initCollpsehide = function() {
  39. $(document).on('click', '.navbar-collapse.show', function(e) {
  40. if ($(e.target).is('a')) {
  41. $(this).collapse('hide');
  42. }
  43. });
  44. },
  45.  
  46. Craton.prototype.initScrollspy = function() {
  47. $("#navbarCollapse").scrollspy({
  48. offset: 70
  49. });
  50. },
  51.  
  52. Craton.prototype.initMFPImage = function() {
  53. $('.img-zoom').magnificPopup({
  54. type: 'image',
  55. closeOnContentClick: true,
  56. mainClass: 'mfp-fade',
  57. gallery: {
  58. enabled: true,
  59. navigateByImgClick: true,
  60. preload: [0, 1]
  61. }
  62. });
  63. },
  64.  
  65. Craton.prototype.initWorkFilter = function() {
  66. $(window).on('load', function() {
  67. var $container = $('.work-filter');
  68. var $filter = $('#menu-filter');
  69. $container.isotope({
  70. filter: '*',
  71. layoutMode: 'masonry',
  72. animationOptions: {
  73. duration: 750,
  74. easing: 'linear'
  75. }
  76. });
  77.  
  78. $filter.find('a').on("click", function() {
  79. var selector = $(this).attr('data-filter');
  80. $filter.find('a').removeClass('active');
  81. $(this).addClass('active');
  82. $container.isotope({
  83. filter: selector,
  84. animationOptions: {
  85. animationDuration: 750,
  86. easing: 'linear',
  87. queue: false,
  88. }
  89. });
  90. return false;
  91. });
  92. });
  93. },
  94.  
  95. Craton.prototype.initClientSlider = function() {
  96. $("#owl-testi").owlCarousel({
  97. autoPlay: 10000,
  98. items: 3,
  99. itemsDesktop: [1199, 3],
  100. itemsDesktopSmall: [979, 2]
  101. });
  102. },
  103.  
  104. Craton.prototype.initteamSlider = function() {
  105. $("#owl-team").owlCarousel({
  106. autoPlay: 10000,
  107. items: 4,
  108. itemsDesktop: [1199, 3],
  109. itemsDesktopSmall: [979, 2]
  110. });
  111. },
  112.  
  113. Craton.prototype.initMFPVideoPlay = function() {
  114. $('.video_presentation_play').magnificPopup({
  115. disableOn: 700,
  116. type: 'iframe',
  117. mainClass: 'mfp-fade',
  118. removalDelay: 160,
  119. preloader: false,
  120. fixedContentPos: false
  121. });
  122. },
  123.  
  124. Craton.prototype.initBTT = function() {
  125. $(window).on('scroll', function() {
  126. if ($(this).scrollTop() > 100) {
  127. $('.back_top').fadeIn();
  128. } else {
  129. $('.back_top').fadeOut();
  130. }
  131. });
  132. $('.back_top').on('click', function() {
  133. $("html, body").animate({
  134. scrollTop: 0
  135. }, 1000);
  136. return false;
  137. });
  138. },
  139.  
  140. Craton.prototype.init = function() {
  141. this.initStickyAddMenu();
  142. this.initSmoothLink();
  143. this.initCollpsehide();
  144. this.initScrollspy();
  145. this.initMFPImage();
  146. this.initWorkFilter();
  147. this.initClientSlider();
  148. this.initteamSlider();
  149. this.initMFPVideoPlay();
  150. this.initBTT();
  151. },
  152. //init
  153. $.Craton = new Craton, $.Craton.Constructor = Craton
  154. }(window.jQuery),
  155.  
  156. //initializing
  157. function($) {
  158. "use strict";
  159. $.Craton.init();
  160. }(window.jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement