1.0.4 • Published 4 years ago

svelte-lazy-image-loader v1.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Svelte Lazy Image Loader

Shows a loading animation while loading an imagine.

Without placeholder animation:

enter image description here

With placeholder:

enter image description here

Install

npm

npm i svelte-lazy-image-loader

yarn

yarn add svelte-lazy-image-loader

API

PropsValue
urlimage url as string
altalt text as string
imageWidthwidth of the image as string. Defaults to 100%.
imageHeightheight of the image as string
placeholderWidthwidth of the placeholder as string. Defaults to 100%.
placeholderHeightheight of the placeholder as string. Defaults to 400px.
stylingCSS properties as string

Examples

Default placeholder:

<script>
	import ImageLoader from 'svelte-lazy-image-loader';
</script>

<ImageLoader
	url="https://example.com/image.png"
	alt="example image"
	imageWidth="500px"
	imageHeight="200px"
	placeholderWidth="500px"
	placeholderHeight="200px"
	styling="margin-right: 1rem; padding: 1rem;"
/>

Custom placeholder:

<script>
	import ImageLoader from 'svelte-lazy-image-loader';
</script>

<ImageLoader
	url="https://example.com/image.png"
	alt="example image"
	imageHeight="200px"
	placeholderHeight="200px"
>
	<div>loading</div>
</ImageLoader>
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

5 years ago