Lazy-load place photos

Only preload photos in view as well as the next one(s), not all of them
This commit is contained in:
2026-04-22 12:02:44 +04:00
parent b83a16bf13
commit d1d179bb93
3 changed files with 60 additions and 15 deletions

View File

@@ -123,11 +123,11 @@ export default class PlacePhotosCarousel extends Component {
{{#if photo.thumbUrl}}
<source
media="(max-width: 768px)"
srcset={{photo.thumbUrl}}
data-srcset={{photo.thumbUrl}}
/>
{{/if}}
<img
src={{photo.url}}
data-src={{photo.url}}
class="place-header-photo landscape"
alt={{@name}}
{{fadeInImage photo.url}}
@@ -136,7 +136,7 @@ export default class PlacePhotosCarousel extends Component {
{{else}}
{{! Portrait uses thumb everywhere if available }}
<img
src={{if photo.thumbUrl photo.thumbUrl photo.url}}
data-src={{if photo.thumbUrl photo.thumbUrl photo.url}}
class="place-header-photo portrait"
alt={{@name}}
{{fadeInImage (if photo.thumbUrl photo.thumbUrl photo.url)}}