123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- /* ========================================================================= */
- /* Page Preloader
- /* ========================================================================= */
-
- $(window).on('load', function () {
- $('.preloader').fadeOut(100);
- });
-
- jQuery(function ($) {
- "use strict";
-
-
- /* ========================================================================= */
- /* Auto close Navbar when click on link
- /* ========================================================================= */
-
- $('.navbar-collapse a').click(function () {
- $(".navbar-collapse").collapse('hide');
- });
-
-
- /* ========================================================================= */
- /* lazy load initialize
- /* ========================================================================= */
-
- const observer = lozad(); // lazy loads elements with default selector as ".lozad"
- observer.observe();
-
- /* ========================================================================= */
- /* Magnific popup
- /* ========================================================================= */
- $('.image-popup').magnificPopup({
- type: 'image',
- removalDelay: 160, //delay removal by X to allow out-animation
- callbacks: {
- beforeOpen: function () {
- // just a hack that adds mfp-anim class to markup
- this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
- this.st.mainClass = this.st.el.attr('data-effect');
- }
- },
- closeOnContentClick: true,
- midClick: true,
- fixedContentPos: false,
- fixedBgPos: true
- });
-
- /* ========================================================================= */
- /* Portfolio Filtering Hook
- /* ========================================================================= */
-
- var containerEl = document.querySelector('.shuffle-wrapper');
- if (containerEl) {
- var Shuffle = window.Shuffle;
- var myShuffle = new Shuffle(document.querySelector('.shuffle-wrapper'), {
- itemSelector: '.shuffle-item',
- buffer: 1
- });
-
- jQuery('input[name="shuffle-filter"]').on('change', function (evt) {
- var input = evt.currentTarget;
- if (input.checked) {
- myShuffle.filter(input.value);
- }
- });
- }
-
- /* ========================================================================= */
- /* Testimonial Carousel
- /* ========================================================================= */
-
- $("#testimonials").slick({
- infinite: true,
- arrows: false,
- autoplay: true,
- autoplaySpeed: 4000
- });
-
- /* ========================================================================= */
- /* animation scroll js
- /* ========================================================================= */
-
- var html_body = $('html, body');
- $('nav a, .page-scroll').on('click', function () { //use page-scroll class in any HTML tag for scrolling
- if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
- var target = $(this.hash);
- target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
- if (target.length) {
- html_body.animate({
- scrollTop: target.offset().top - 50
- }, 1500, 'easeInOutExpo');
- return false;
- }
- }
- });
-
- // easeInOutExpo Declaration
- jQuery.extend(jQuery.easing, {
- easeInOutExpo: function (x, t, b, c, d) {
- if (t === 0) {
- return b;
- }
- if (t === d) {
- return b + c;
- }
- if ((t /= d / 2) < 1) {
- return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
- }
- return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
- }
- });
-
- /* ========================================================================= */
- /* counter up
- /* ========================================================================= */
- function counter() {
- var oTop;
- if ($('.count').length !== 0) {
- oTop = $('.count').offset().top - window.innerHeight;
- }
- if ($(window).scrollTop() > oTop) {
- $('.count').each(function () {
- var $this = $(this),
- countTo = $this.attr('data-count');
- $({
- countNum: $this.text()
- }).animate({
- countNum: countTo
- }, {
- duration: 1000,
- easing: 'swing',
- step: function () {
- $this.text(Math.floor(this.countNum));
- },
- complete: function () {
- $this.text(this.countNum);
- }
- });
- });
- }
- }
- $(window).on('scroll', function () {
- counter();
- });
-
- });
|