var ajust_product_image = function () { function api() { } api.max_height = 800; api.model = 'min'; api.selector = '.product-item img'; api.class = 'ajust-loop-product__image'; api.height = 0; api.times = 0; api.start = function () { this.height = this.model == 'max' ? 0 : this.max_height; var img_list = document.querySelectorAll(this.selector); if (!img_list) return; this.times++; img_list.forEach(n => { var h = n.height; if (this.model == 'max') { if (h > this.height) { this.height = h; } } else { if (h < this.height) { this.height = h; } } }) if (this.height <= 50) { if (this.times < 10) { setTimeout(function () { api.start(); }, 5000); } return; } img_list.forEach(n => { n.style.height = this.height + "px"; n.style.maxHeight = this.max_height + 'px'; n.classList.add(this.class); }) } api.load = function () { if (screen.width < 600) return; window.addEventListener('load', function () { api.start(); }) setTimeout(function () { api.start(); }, 1000); } return api; }(); ajust_product_image.load();