i've build myself a jQuery filter option on an existing portfolio page. The thing is, theres a onScroll in a function that keeps adding the class 'reveal' on the portfolio items, when they are in the users viewport.
Now i want to disable this function when my function is sort of "running". Here is my code:
  function filterPortfolio() {
    $('[data-filter]').on('click', function() {
    var filterPortfolioIsRunning = true;
    var filter = $(this);
    var filterVal = $(this).attr('data-filter');
    var filterItems = $('[data-filter-item]');
    filter.toggleClass('active');
    filterItems.removeClass('reveal');
    filterItems.closest('.columns').addClass('hidden');
  if ($('[data-filter]').hasClass('active')) {
            $('[data-filter].active').each(function(){
                var filters = $(this).attr('data-filter');
                var object = $('[data-filter-item][data-filter-val*="' + filters + '"]');
                object.closest('.columns').removeClass('hidden');
                object.addClass('reveal');
            });
  } else {
        filterItems.closest('.columns').removeClass('hidden');
        filterItems.addClass('reveal');
  }
});
}
Now i have set "filterPortfolioIsRunning" to true, and want to recognise this in an other jQuery function. This code:
  function revealProject() {
var scrollTop = $(document).scrollTop();
$('.project').each(function(e) {
  if ($(window).width() > 767 && scrollTop > 0) {
    if (($(this).offset().top + ($(this).height() - 200)) < (scrollTop + $(window).height())) {
      $(this).addClass('reveal');
    }
  } else if ($(window).width() < 768) {
    if (($(this).offset().top) < (scrollTop + $(window).height())) {
      $(this).addClass('reveal');
    }
  }
});
if ($('.project').length > 0) {
  setTimeout(function() {
    $('.projects .columns:nth-child(1) .project, .projects .columns:nth-child(2) .project').addClass('reveal');
  }, 2300);
}
}
I have tried doing it like this: && !filterPortfolioIsRunning == true but the console log says it can't find the variable. How can i make this work?
Thanks in advance!
 
     
    