Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

script.js 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. jQuery(function ($) {
  2. "use strict";
  3. /* ========================================================================= */
  4. /* Page Preloader
  5. /* ========================================================================= */
  6. $(window).on('load', function () {
  7. $('.preloader').fadeOut(100);
  8. });
  9. /* ========================================================================= */
  10. /* lazy load initialize
  11. /* ========================================================================= */
  12. const observer = lozad(); // lazy loads elements with default selector as ".lozad"
  13. observer.observe();
  14. /* ========================================================================= */
  15. /* Magnific popup
  16. /* ========================================================================= */
  17. $('.image-popup').magnificPopup({
  18. type: 'image',
  19. removalDelay: 160, //delay removal by X to allow out-animation
  20. callbacks: {
  21. beforeOpen: function () {
  22. // just a hack that adds mfp-anim class to markup
  23. this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
  24. this.st.mainClass = this.st.el.attr('data-effect');
  25. }
  26. },
  27. closeOnContentClick: true,
  28. midClick: true,
  29. fixedContentPos: false,
  30. fixedBgPos: true
  31. });
  32. /* ========================================================================= */
  33. /* Portfolio Filtering Hook
  34. /* ========================================================================= */
  35. var containerEl = document.querySelector('.shuffle-wrapper');
  36. if (containerEl) {
  37. var Shuffle = window.Shuffle;
  38. var myShuffle = new Shuffle(document.querySelector('.shuffle-wrapper'), {
  39. itemSelector: '.shuffle-item',
  40. buffer: 1
  41. });
  42. jQuery('input[name="shuffle-filter"]').on('change', function (evt) {
  43. var input = evt.currentTarget;
  44. if (input.checked) {
  45. myShuffle.filter(input.value);
  46. }
  47. });
  48. }
  49. /* ========================================================================= */
  50. /* Testimonial Carousel
  51. /* ========================================================================= */
  52. $("#testimonials").slick({
  53. infinite: true,
  54. arrows: false,
  55. autoplay: true,
  56. autoplaySpeed: 4000
  57. });
  58. /* ========================================================================= */
  59. /* animation scroll js
  60. /* ========================================================================= */
  61. var html_body = $('html, body');
  62. $('nav a, .page-scroll').on('click', function () { //use page-scroll class in any HTML tag for scrolling
  63. if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
  64. var target = $(this.hash);
  65. target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
  66. if (target.length) {
  67. html_body.animate({
  68. scrollTop: target.offset().top - 50
  69. }, 1500, 'easeInOutExpo');
  70. return false;
  71. }
  72. }
  73. });
  74. // easeInOutExpo Declaration
  75. jQuery.extend(jQuery.easing, {
  76. easeInOutExpo: function (x, t, b, c, d) {
  77. if (t === 0) {
  78. return b;
  79. }
  80. if (t === d) {
  81. return b + c;
  82. }
  83. if ((t /= d / 2) < 1) {
  84. return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
  85. }
  86. return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
  87. }
  88. });
  89. /* ========================================================================= */
  90. /* counter up
  91. /* ========================================================================= */
  92. function counter() {
  93. var oTop;
  94. if ($('.count').length !== 0) {
  95. oTop = $('.count').offset().top - window.innerHeight;
  96. }
  97. if ($(window).scrollTop() > oTop) {
  98. $('.count').each(function () {
  99. var $this = $(this),
  100. countTo = $this.attr('data-count');
  101. $({
  102. countNum: $this.text()
  103. }).animate({
  104. countNum: countTo
  105. }, {
  106. duration: 1000,
  107. easing: 'swing',
  108. step: function () {
  109. $this.text(Math.floor(this.countNum));
  110. },
  111. complete: function () {
  112. $this.text(this.countNum);
  113. }
  114. });
  115. });
  116. }
  117. }
  118. $(window).on('scroll', function () {
  119. counter();
  120. });
  121. });