{"version":3,"file":"lazyLoadProducts.js","names":["lazyLoadMain","lazyConts","$","lazyImages","i","len","length","src","dataset","onload","hide","onerror","offset","getBoundingClientRect","top","window","pageYOffset","innerHeight","lazyFx","removeEventListener","addEventListener","document","ajaxStop","setTimeout","on","scrollTop"],"sources":["lazyLoadProducts.js"],"sourcesContent":["function lazyLoadMain(){\n    var lazyConts = $(\".lazy_container\");\n    var lazyImages = $(\".lazy_img\"); \n    for (var i = 0, len = lazyConts.length; i < len; i++) {\n        (function(i) {\n            // Load images if first 3 images\n            if( i < 3){\n                lazyImages[i].src = lazyImages[i].dataset.src;\n            }\n            lazyImages[i].onload = function() {\n                $('span.loader').hide();\n                lazyImages[i].onerror = null;\n            };\n\n            var offset = lazyConts[i].getBoundingClientRect().top + window.pageYOffset - window.innerHeight;\n            var lazyFx = function() {\n                if (window.pageYOffset > offset) {\n                // the image is appearing in the viewport\n                    lazyImages[i].src = lazyImages[i].dataset.src;\n                    window.removeEventListener(\"scroll\", lazyFx);\n                    lazyFx = null;\n                }\n            };\n            \n            window.addEventListener(\"scroll\", lazyFx);\n\n        })(i);\n    }\n}\n$(document).ajaxStop(function(){\n    // console.log('ajax call completed');\n    setTimeout(function(){ \n        lazyLoadMain();\n    }, 250);\n    $( \"body .refinement-bar button\" ).on( \"click\", function() {        \n        // console.log( \"clicking images\" );\n        setTimeout(function(){ \n            var lazyConts = $(\".lazy_container\");\n            var lazyImages = $(\".lazy_img\");\n            for (var i = 3, len = lazyConts.length; i < len; i++) {\n                lazyImages[i].src = lazyImages[i].dataset.src;\n            }            \n        }, 600);\n    });\n    setTimeout(function(){ \n        $(window).scrollTop($(window).scrollTop()+0.6);\n    }, 300);\n});\n"],"mappings":"AAAA,SAASA,eAGL,IAFA,IAAIC,EAAYC,EAAE,mBACdC,EAAaD,EAAE,aACVE,EAAI,EAAGC,EAAMJ,EAAUK,OAAQF,EAAIC,EAAKD,KAC7C,SAAUA,GAEFA,EAAI,IACJD,EAAWC,GAAGG,IAAMJ,EAAWC,GAAGI,QAAQD,KAE9CJ,EAAWC,GAAGK,OAAS,WACnBP,EAAE,eAAeQ,OACjBP,EAAWC,GAAGO,QAAU,IAC5B,EAEA,IAAIC,EAASX,EAAUG,GAAGS,wBAAwBC,IAAMC,OAAOC,YAAcD,OAAOE,YAChFC,EAAS,WACLH,OAAOC,YAAcJ,IAErBT,EAAWC,GAAGG,IAAMJ,EAAWC,GAAGI,QAAQD,IAC1CQ,OAAOI,oBAAoB,SAAUD,GACrCA,EAAS,KAEjB,EAEAH,OAAOK,iBAAiB,SAAUF,EAErC,CAtBD,CAsBGd,EAEX,CACAF,EAAEmB,UAAUC,UAAS,WAEjBC,YAAW,WACPvB,cACJ,GAAG,KACHE,EAAG,+BAAgCsB,GAAI,SAAS,WAE5CD,YAAW,WAGP,IAFA,IAAItB,EAAYC,EAAE,mBACdC,EAAaD,EAAE,aACVE,EAAI,EAAGC,EAAMJ,EAAUK,OAAQF,EAAIC,EAAKD,IAC7CD,EAAWC,GAAGG,IAAMJ,EAAWC,GAAGI,QAAQD,GAElD,GAAG,IACP,IACAgB,YAAW,WACPrB,EAAEa,QAAQU,UAAUvB,EAAEa,QAAQU,YAAY,GAC9C,GAAG,IACP"}