Commit 9bb80d0c by liumengfei

优化产品列表加载图片预热图

顶部logo文件js过滤
parent be809ca3
......@@ -119,9 +119,9 @@ $_helper = $block->getData('outputHelper');
<?php
$productImageRaw = $imageHelper->init($_product, $imageDisplayArea)->setImageFile($productImage->getFile())->resize($productImage->getWidth(),$productImage->getHeight())->getUrl();
?>
<img class="product-image-photo" data-src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>" height="<?= $productImage->getHeight() ?>" alt="Image">
<img class="product-image-photo" data-src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" src="/media/catalog/image.jpg" />
<?php if ($hoverImg): ?>
<img class="hoverImg" width="<?= $productImage->getWidth() ?>" height="<?= $productImage->getHeight() ?>" data-src="<?= $hoverImg ?>" loading="lazy" />
<img class="hoverImg" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" data-src="<?= $hoverImg ?>" loading="lazy" />
<?php endif; ?>
</a>
<div class="product details product-item-details">
......
......@@ -25,6 +25,25 @@
$(".page-header .actions.search-dropdown").click(function () {
$("#search_mini_form_input").toggle();
});
//auto logo height
if (flag){
var imgH = $('.logo').height();
imgH= Math.ceil(imgH/3);
$('.header ').css('margin-bottom',imgH);
}
else{
//var headerH = $('.page-header').outerHeight(true);
$('.columns').css('margin-top',0);
}
//free shipping bar not existent
if(!flag && !$('.sparsh-free-shipping-bar-goal-message').length){
$('.page-header').css('margin-top','0');
}
if (flag){
var imgH = $('.logo').height();
imgH= Math.ceil(imgH/3);
......
......@@ -19,40 +19,6 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
? $logoSizeResolver->getHeight()
: $block->getLogoHeight();
?>
<script>
var userAgentInfo = navigator.userAgent;
var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }
}
require(['jquery'],function ($){
//free shipping bar not existent
if(!flag && !$('.sparsh-free-shipping-bar-goal-message').length){
$('.page-header').css('margin-top','0');
}
//auto logo height
if (flag){
var imgH = $('.logo').height();
imgH= Math.ceil(imgH/3);
$('.header ').css('margin-bottom',imgH);
}
else{
//var headerH = $('.page-header').outerHeight(true);
$('.columns').css('margin-top',0);
}
});
</script>
<style>
.secure-span{
display:none;
......@@ -64,12 +30,12 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
href="<?= $block->escapeUrl($block->getUrl('')) ?>"
title="<?= $block->escapeHtmlAttr($storeName) ?>"
aria-label="store logo">
<img class="site-logo" src="<?= $block->escapeUrl($block->getLogoSrc()) ?>"
<img class="site-logo" data-src="<?= $block->escapeUrl($block->getLogoSrc()) ?>" src="<?= $block->escapeUrl($block->getLogoSrc()) ?>"
title="<?= $block->escapeHtmlAttr($block->getLogoAlt()) ?>"
alt="<?= $block->escapeHtmlAttr($block->getLogoAlt()) ?>"
<?= $logoWidth ? 'width="' . $block->escapeHtmlAttr($logoWidth) . '"' : '' ?>
<?= $logoHeight ? 'height="' . $block->escapeHtmlAttr($logoHeight) . '"' : '' ?>
/>
loading="lazy" />
<span class="secure-span">
<span class="cut-span" >
/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment