中文
English
免责声明:如果您通过本页面的链接进行购买,我们可能会获得报酬。
全部优惠
热门优惠
服装
美妆
运动与户外
电子产品/电脑
健康
母婴
更多
首页>Adidas(US)
adidas Campus 00s shoes $110
Adidas offers the adidas Campus 00s shoes for $110. //计算dom style if (typeof getComputedStyle == 'undefined') { if (document.body.currentStyle) { window.getComputedStyle = function(el) { return el.currentStyle; } } else { window.getComputedStyle = {}; } } /** * 设置lazy高度 * @param outerContainer lazy外层容器(用于计算宽度) * @param images 所有lazy图片 */ function setLazyHeight(outerContainer, images) { var maxWidth, containerStyle, orgSrc, orgRatio, orgWidth, width, imgStyle, imgWidth, actualHeight = 100; //外层容器 maxWidth = outerContainer.offsetWidth; containerStyle = getComputedStyle(outerContainer); maxWidth -= (parseFloat(containerStyle.paddingLeft) + parseFloat(containerStyle.paddingRight)); maxWidth = maxWidth || (window.innerWidth - 30); for (var i = 0, len = images.length; i < len; i++) { orgSrc = images[i].getAttribute('data-src'); orgRatio = images[i].getAttribute('data-ratio'); orgWidth = images[i].getAttribute('data-w') || images[i].getAttribute('data-width'); width = images[i].getAttribute('width'); if (!orgSrc || !parseFloat(orgRatio) || !orgWidth) return true; orgWidth = Math.min(orgWidth,maxWidth); if(width) { orgWidth = Math.min(orgWidth, width); } if (images[i].closest('.dm_table')) { var cell = images[i].closest('td') || images[i].closest('th'); var cellRect = cell.getBoundingClientRect(); orgWidth = Math.min(orgWidth, cellRect.width - 10); // 10: 左右padding之和 } if (orgRatio && orgRatio > 0) { imgStyle = getComputedStyle(images[i]); imgWidth = images[i].style.width; //图片设置过真实宽度 if ( imgWidth && imgWidth != 'auto' ) { orgWidth = parseFloat(imgStyle.width); } actualHeight = orgWidth / orgRatio; var smallImgHeight = orgWidth > 280 ? (280 / orgRatio) : actualHeight; smallImgHeight = statistics.interfacedata.platform === "PC" ? smallImgHeight : maxWidth / orgRatio * 0.4; actualHeight = $(images[i]) .parents('.dm_insert_block') .hasClass('dm_insert_img_small') ? smallImgHeight : actualHeight; } else { images[i].style.cssText += "visibility: hidden !important;"; } images[i].style.cssText += "height: " + actualHeight + "px !important;width: auto;"; } } var doc = document, outContainer = doc.querySelector('.edit-content'); if (doc.addEventListener) { doc.addEventListener('DOMContentLoaded', function() { if (outContainer) { setLazyHeight(outContainer, [].filter.call(doc.querySelectorAll('.edit-content img.lazyload'), item => !item.closest('.dm_table'))); } }); } else { doc.onreadystatechange = function() { if (doc.readyState === 'complete') { if (outContainer) { setLazyHeight(outContainer, [].filter.call(doc.querySelectorAll('.edit-content img.lazyload'), item => !item.closest('.dm_table'))); } } } }
分享
Adidas