/** * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author Apply Novation (Artem Zwinger) * @copyright 2016-2017 Apply Novation * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ function lazyload_init(){ new Blazy({ selector: '.b-lazy:not(.b-initialized)', loadInvisible: true, success: function(element){ element.classList.add('b-initialized'); setTimeout(function(){ // We want to remove the loader gif now. // First we find the parent container // then we remove the "loading" class which holds the loader image var parent = element.parentNode; parent.className = parent.className.replace(/\bloading\b/,''); }, 200); }, error: function(element, msg) { element.classList.add('b-initialized'); //console.error(el, msg); //lazyload_init(); } }); } $(document).ready(function(){ lazyload_init(); $(document).ajaxSuccess(function() { lazyload_init(); }); var timerId; $(document).on("click", function() { clearTimeout(timerId); timerId = setTimeout(function() { var $lazyItems = $('.b-lazy:not(.b-initialized)'); if ($lazyItems.length > 0) { lazyload_init(); } }, 500); }); // $(window).trigger('scroll'); var heightProduct = $(".b-lazy").attr("data-height"); $(".product-thumbnail").css('height', heightProduct); });