(function($) {
    $.fn.visible = function(partial) {

    var $t            = $(this),
        $w            = $(window),
        viewTop       = $w.scrollTop(),
        viewBottom    = viewTop + $w.height(),
        _top          = $t.offset().top,
        _bottom       = _top + $t.height(),
        compareTop    = partial === true ? _bottom : _top,
        compareBottom = partial === true ? _top : _bottom;

     return ((compareBottom <= viewBottom) && (compareTop >= viewTop));

    };

    })(jQuery);

   

    $(window).scroll(function(event) {
      $(".animate-swipe-right").each(function(i, el) {
        var el = $(el);
        if (el.visible(true)) {
            el.addClass("swipe"); 
        } else {
            el.removeClass("swipe");
        }
      });
      $(".animate-swipe-left").each(function(i, el) {
        var el = $(el);
        if (el.visible(true)) {
            el.addClass("swipe"); 
        } else {
            el.removeClass("swipe");
        }
      });
      $(".animate-swipe-up").each(function(i, el) {
        var el = $(el);
        if (el.visible(true)) {
            el.addClass("swipe"); 
        } else {
            el.removeClass("swipe");
        }
      });
      $(".animate-swipe-down").each(function(i, el) {
        var el = $(el);
        if (el.visible(true)) {
            el.addClass("swipe"); 
        } else {
            el.removeClass("swipe");
        }
      });

    });

    $(function() {
        $(window).on("scroll", function() {
            if($(window).scrollTop() > 50) {
                $(".header").addClass("active");
            } else {
                //remove the background property so it comes transparent again (defined in your css)
               $(".header").removeClass("active");
            }
        });
    });

    $(document).ready(function(){
        $('.my-slider').slick({
          slidesToShow: 3,
          slidesToScroll: 1,
          arrows: true,
          dots: true,
          speed: 300,
          infinite: true,
          autoplaySpeed: 5000,
          autoplay: true,
          responsive: [
        {
          breakpoint: 991,
          settings: {
            slidesToShow: 2,
          }
        },
        {
          breakpoint: 767,
          settings: {
            slidesToShow: 1,
          }
        }
      ]
        });
      });


      

$(window).on("scroll load", function () {
  $(".reveal-img").each(function () {
    var $el = $(this);
    if ($el.visible(true)) {
      $el.addClass("in-view");
    } else {
      $el.removeClass("in-view");
    }
  });
});