Skip to content

Commit 9b5fea7

Browse files
committed
Updated README
1 parent 4db9d99 commit 9b5fea7

File tree

2 files changed

+67
-21
lines changed

2 files changed

+67
-21
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ dist
33
*.map
44
npm-debug.log
55
examples
6-
release.sh
6+
release.sh
7+
.idea

README.md

Lines changed: 65 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,36 @@ import VueLazyImageLoading from 'vue-lazy-image-loading'
2323
Vue.use(VueLazyImageLoading)
2424
```
2525

26-
#### Progressive image
26+
#### Lazy image
2727

2828
Instead of using the normal `img` tag to load images
2929

3030
```html
3131
<img src="https://unsplash.it/1920/1080?image=10" />
3232
```
3333

34-
use the `progressive-img` component already globally available after the plugin installation
34+
use the `lazy-img` component already globally available after the plugin installation
3535

3636
```html
3737
<lazy-img src="https://unsplash.it/1920/1080?image=10" />
3838
```
3939

40-
#### Progressive background
40+
#### Lazy background
4141

42-
It is also possible to apply progressive images as backgrounds and it will have the same props as the progressive-img component
42+
It is also possible to apply lazy images as backgrounds and it will have the same props as the lazy-img component
4343

4444
```html
4545
<lazy-background src="https://unsplash.it/1920/1080?image=10" />
4646
```
4747

48+
## Global properties
4849

49-
## Placeholders
50+
There is all properties you can use for both `lazy-img` and `lazy-background` components.
5051

52+
### Placeholder
5153
To be able to immediately show some feedback to the user, it is possible to pass a placeholder image, which could be also 1% the size of the main image: it will be blurred so you can go crazy with optimizations here.
5254

53-
in this example I actually use the same image, but you have the idea here
55+
In this example I actually use the same image, but you have the idea here
5456

5557
```html
5658
<lazy-img
@@ -59,20 +61,6 @@ in this example I actually use the same image, but you have the idea here
5961
/>
6062
```
6163

62-
### The slot (progressive-background only)
63-
64-
The progressive-background has a "content" slot, which can hold content that needs to be rendered over the background image and also can hold a preloader.
65-
This slot has one property called "visible" that tells you when, for example, a preloader needs to be visible or not.
66-
67-
```html
68-
<lazy-background src="https://unsplash.it/1920/1080?image=10">
69-
<div slot="content" slot-scope="{ visible }">
70-
<p>I am some content to display over the image</p>
71-
<div v-show="visible">I am the preloader</div>
72-
</div>
73-
</lazy-background>
74-
```
75-
7664
### Blur
7765

7866
It is possible to adjust the level of blur applied to the placeholder image
@@ -106,6 +94,63 @@ It is also possible to manually specify the image aspact ratio when you know it.
10694
/>
10795
```
10896

97+
## `lazy-background` properties
98+
99+
There is all properties you can use for the `lazy-background` component only.
100+
101+
### Background position
102+
103+
Allows you to set the value of the `background-position` CSS property.
104+
105+
The default value is `0% 0%`.
106+
107+
```html
108+
<lazy-background
109+
src="https://unsplash.it/1920/1080?image=10"
110+
position="center"
111+
/>
112+
```
113+
114+
### Background size
115+
116+
Allows you to set the value of the `background-size` CSS property.
117+
118+
The default value is `cover`.
119+
120+
```html
121+
<lazy-background
122+
src="https://unsplash.it/1920/1080?image=10"
123+
size="contain"
124+
/>
125+
```
126+
127+
### Background repeat
128+
129+
Allows you to set the value of the `background-repeat` CSS property.
130+
131+
The default value is `no-repeat`.
132+
133+
```html
134+
<lazy-background
135+
src="https://unsplash.it/1920/1080?image=10"
136+
repeat="repeat-x"
137+
/>
138+
```
139+
140+
### The slot
141+
142+
The lazy-background has a "content" slot, which can hold content that needs to be rendered over the background image and also can hold a preloader.
143+
This slot has one property called "visible" that tells you when, for example, a preloader needs to be visible or not.
144+
145+
```html
146+
<lazy-background src="https://unsplash.it/1920/1080?image=10">
147+
<div slot="content" slot-scope="{ visible }">
148+
<p>I am some content to display over the image</p>
149+
<div v-show="visible">I am the preloader</div>
150+
</div>
151+
</lazy-background>
152+
```
153+
109154
## Image fallback
110155

111156
In case of a loading error of the main image, it is possible to add a fallback image which can display an error image or just another image.

0 commit comments

Comments
 (0)