Close

Async Image Loading - problem

mrbombay
11 years ago
#2074 Quote
Avatar
  • 10
Hi Nop-Templates,

I use JAIL - image loading, and after filtering my images are not showing. So i think i have to call a function after the filter is done to activate my async image loading. Where should i do that, or what would be the solution?

At head of my website:

    // img async loaden
    $('img.lazy').jail({
        effect: 'fadeIn',
        placeholder: '/Content/img/img-loader.gif',
        loadHiddenImages: true
    });

Boyko
11 years ago
#2075 Quote
Avatar
  • Moderator
  • 1570
mrbombay wrote:
Hi Nop-Templates,

I use JAIL - image loading, and after filtering my images are not showing. So i think i have to call a function after the filter is done to activate my async image loading. Where should i do that, or what would be the solution?

At head of my website:

    // img async loaden
    $('img.lazy').jail({
        effect: 'fadeIn',
        placeholder: '/Content/img/img-loader.gif',
        loadHiddenImages: true
    });



Hi mrbombay,

You can try to execute some custom logic on ajax complete as the Filters make an ajax request to the server to get the filtered products.
$(document).ajaxComplete(function (event, xmlHttpRequest) { 
add your logic here
}


But this is not the best approach as there might be other ajax requests to the server except the ones that Ajax Filters do.

Basically the Filters get the filtered products and replace the whole category panel with the result. So as a result some new html that has images in it is added to the DOM.
I am not familiar with JAIL but it should work with images that are dynamically added to the DOM.
Probably there is some setting or something to make it work in this scenario.

Please let us know if you manage to make this work.

Thanks
Regards,
Nop-Templates.com Team