I found a few questions similar to mine, but nothing to do with a filter result so I have been struggling finding something that works for me. On a website page, I have image tiles that are filtered down when different links are clicked. My problem is that my fade in trigger is happening when the images are still loading and it looks horrible.
How can I trigger my fadeIn to go off only after all my images are fully loaded?
$(document).ready(function() {
$(document).on('click', '.js-filter-item > a', function(e){
e.preventDefault();
var category = $(this).data('category')
$.ajax({
url: wpAjax.ajaxUrl,
data: { action: 'filter', category: category },
type: 'post',
beforeSend: function() {
$("#projects-container").slideUp();
},
success: function(result) {
$("#projects-container").hide().html(result).fadeIn(1500);
$(".misha_loadmore").hide();
},
error: function(result) {
console.warn(result);
}
});
});
}