Skip to content

PrismicImage lazy loading Svelteย #18

@GalichCZ

Description

@GalichCZ

I have an issue with handling images with slow internet connection in svelte app using prismic library
I've tried to use on:load like this

<script>
  import { PrismicImage } from '@prismicio/svelte'

  const a = () => {
    console.log(1)
  }
</script>
<PrismicImage
        on:load={a}
        on:loadeddata={()=>console.log(1)}
        on:loadedmetadata={()=>console.log(1)}
        loading='lazy'
        style="position: absolute; z-index: 1; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 3rem; -webkit-clip-path: url(#{pathID}); clip-path: url(#{pathID});"
        {field}
        imgixParams={{ q: 30 }}
      />

but there is no any reaction on load and I do not really see any difference if I have loading='lazy'

It is the copy paste of my question on prismic community.

My suggestion is pretty simple, it would be nice to have working on:load handlers in PrismicImage component

BTW, thank you for easy understandable webs and docs :D

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions