Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
joshine
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
joshine
Commits
6ad327b9
Commit
6ad327b9
authored
May 11, 2023
by
liumengfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
恢复图片列表图片加载方式
parent
d1d35948
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
32 deletions
+4
-32
app/design/frontend/Joshine/breeze/Magento_Catalog/templates/product/list.phtml
+2
-29
app/design/frontend/Joshine/breeze/Magento_Theme/templates/html/header/logo.phtml
+2
-3
No files found.
app/design/frontend/Joshine/breeze/Magento_Catalog/templates/product/list.phtml
View file @
6ad327b9
...
@@ -120,9 +120,9 @@ $_helper = $block->getData('outputHelper');
...
@@ -120,9 +120,9 @@ $_helper = $block->getData('outputHelper');
<?php
<?php
$productImageRaw
=
$imageHelper->init
(
$_product
,
$imageDisplayArea
)->setImageFile(
$productImage->getFile
())->resize(
$productImage->getWidth
(),
$productImage->getHeight
())->getUrl();
$productImageRaw
=
$imageHelper->init
(
$_product
,
$imageDisplayArea
)->setImageFile(
$productImage->getFile
())->resize(
$productImage->getWidth
(),
$productImage->getHeight
())->getUrl();
?>
?>
<img class="
product
-
image
-
photo
" style="
background
-
color
:
#F0F0F0;border: none;"
data-
src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" />
<img class="
product
-
image
-
photo
" style="
background
-
color
:
#F0F0F0;border: none;" src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" />
<?
php
if
(
$hoverImg
)
:
?>
<?
php
if
(
$hoverImg
)
:
?>
<img
class=
"hoverImg"
width=
"
<?=
$productImage
->
getWidth
()
?>
px"
height=
"
<?=
$productImage
->
getHeight
()
?>
px"
data-
src=
"
<?=
$hoverImg
?>
"
loading=
"lazy"
/>
<img
class=
"hoverImg"
width=
"
<?=
$productImage
->
getWidth
()
?>
px"
height=
"
<?=
$productImage
->
getHeight
()
?>
px"
src=
"
<?=
$hoverImg
?>
"
loading=
"lazy"
/>
<?php
endif
;
?>
<?php
endif
;
?>
</a>
</a>
<div
class=
"product details product-item-details"
>
<div
class=
"product details product-item-details"
>
...
@@ -237,31 +237,4 @@ $_helper = $block->getData('outputHelper');
...
@@ -237,31 +237,4 @@ $_helper = $block->getData('outputHelper');
'item'
:
<?=
json_encode
(
$items
,
true
)
?>
'item'
:
<?=
json_encode
(
$items
,
true
)
?>
})
})
</script>
</script>
<script>
const
imgs
=
document
.
getElementsByTagName
(
"img"
);
const
viewHeight
=
window
.
innerHeight
||
document
.
documentElement
.
clientHeight
;
let
num
=
0
;
function
lazyload
()
{
for
(
let
i
=
num
;
i
<
imgs
.
length
;
i
++
)
{
let
distance
=
viewHeight
-
imgs
[
i
].
getBoundingClientRect
().
top
;
if
(
distance
>=
0
)
{
imgs
[
i
].
src
=
imgs
[
i
].
getAttribute
(
"data-src"
);
num
=
i
+
1
;
}
}
}
function
debounce
(
fn
,
delay
=
100
)
{
let
timer
=
null
;
return
function
(...
args
)
{
if
(
timer
)
clearTimeout
(
timer
);
timer
=
setTimeout
(()
=>
{
fn
.
call
(
this
,
args
);
},
delay
);
};
}
window
.
onload
=
lazyload
;
window
.
addEventListener
(
"scroll"
,
debounce
(
lazyload
,
100
),
false
);
</script>
<?php
endif
;
?>
<?php
endif
;
?>
app/design/frontend/Joshine/breeze/Magento_Theme/templates/html/header/logo.phtml
View file @
6ad327b9
...
@@ -25,12 +25,11 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
...
@@ -25,12 +25,11 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
href=
"
<?=
$block
->
escapeUrl
(
$block
->
getUrl
(
''
))
?>
"
href=
"
<?=
$block
->
escapeUrl
(
$block
->
getUrl
(
''
))
?>
"
title=
"
<?=
$block
->
escapeHtmlAttr
(
$storeName
)
?>
"
title=
"
<?=
$block
->
escapeHtmlAttr
(
$storeName
)
?>
"
aria-label=
"store logo"
>
aria-label=
"store logo"
>
<img
class=
"site-logo"
data-src=
"
<?=
$block
->
escapeUrl
(
$block
->
getLogoSrc
())
?>
"
src=
"
<?=
$block
->
escapeUrl
(
$block
->
getLogoSrc
())
?>
"
<img
class=
"site-logo"
src=
"
<?=
$block
->
escapeUrl
(
$block
->
getLogoSrc
())
?>
"
title=
"
<?=
$block
->
escapeHtmlAttr
(
$block
->
getLogoAlt
())
?>
"
title=
"
<?=
$block
->
escapeHtmlAttr
(
$block
->
getLogoAlt
())
?>
"
alt=
"
<?=
$block
->
escapeHtmlAttr
(
$block
->
getLogoAlt
())
?>
"
alt=
"
<?=
$block
->
escapeHtmlAttr
(
$block
->
getLogoAlt
())
?>
"
<?=
$logoWidth
?
'width="'
.
$block
->
escapeHtmlAttr
(
$logoWidth
)
.
'"'
:
''
?>
<?=
$logoWidth
?
'width="'
.
$block
->
escapeHtmlAttr
(
$logoWidth
)
.
'"'
:
''
?>
<?=
$logoHeight
?
'height="'
.
$block
->
escapeHtmlAttr
(
$logoHeight
)
.
'"'
:
''
?>
<?=
$logoHeight
?
'height="'
.
$block
->
escapeHtmlAttr
(
$logoHeight
)
.
'"'
:
''
?>
/>
loading=
"lazy"
/>
<?php
if
(
$block
->
getRequest
()
->
getModuleName
()
==
"checkout"
)
{
?>
<?php
if
(
$block
->
getRequest
()
->
getModuleName
()
==
"checkout"
)
{
?>
<span
class=
"secure-span"
>
<span
class=
"secure-span"
>
<span
class=
"cut-span"
>
<span
class=
"cut-span"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment