Last active
September 3, 2018 04:48
-
-
Save dcooney/ea26f9e2fcf0b57d95ef to your computer and use it in GitHub Desktop.
Ajax Load More - Filtering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
// Filter Ajax Load More | |
var alm_is_animating = false; | |
$('#alm-filter-nav li').eq(0).addClass('active'); // Set the initial button active state | |
// Nav btn click event | |
$('#alm-filter-nav li a').on('click', function(e){ | |
e.preventDefault(); | |
var el = $(this); // Our selected element | |
if(!el.hasClass('active') && !alm_is_animating){ // Check for active and !alm_is_animating | |
alm_is_animating = true; | |
el.parent().addClass('active').siblings('li').removeClass('active'); // Add active state | |
var data = el.data(), // Get data values from selected menu item | |
transition = 'fade', // 'slide' | 'fade' | null | |
speed = '300'; //in milliseconds | |
$.fn.almFilter(transition, speed, data); // reset Ajax Load More (transition, speed, data) | |
} | |
}); | |
$.fn.almFilterComplete = function(){ | |
alm_is_animating = false; // clear alm_isanimating flag | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment