Skip to content

Commit 02c10e5

Browse files
committed
📦 📖 update README
1 parent 191bec6 commit 02c10e5

File tree

2 files changed

+115
-10
lines changed

2 files changed

+115
-10
lines changed

README.md

Lines changed: 114 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,130 @@
66
```html
77
<custom-element-demo>
88
<template>
9-
<script type="module" src="/dist/virtual-scroll.js"></script>
9+
<script type="importmap">
10+
{
11+
"imports": {
12+
"lit-element": "//unpkg.com/lit-element@2.4.0/lit-element.js",
13+
"lit-html/": "//unpkg.com/lit-html@1.4.1/"
14+
}
15+
}
16+
</script>
17+
<script type="module" src="./dist/virtual-scroll.es.js"></script>
18+
<style>
19+
html,
20+
body {
21+
width: 100%;
22+
height: 100%;
23+
margin: 0;
24+
background-color: #ddd;
25+
}
26+
body {
27+
box-sizing: border-box;
28+
padding: 10px 20px;
29+
align-items: center;
30+
justify-content: stretch;
31+
}
32+
scroll-viewport {
33+
width: 100%;
34+
height: 100%;
35+
background-color: #999;
36+
position: relative;
37+
}
38+
.list-1 .block-card-item {
39+
--card-color: #2196f3;
40+
/* background: linear-gradient(45deg, #2196f3, transparent); */
41+
}
42+
.list-2 .block-card-item {
43+
--card-color: #e91e63;
44+
/* background: linear-gradient(45deg, #e91e63, transparent); */
45+
}
46+
.block-card-item {
47+
height: 200px;
48+
width: 100%;
49+
box-sizing: border-box;
50+
--card-color: #2196f3;
51+
/* border: 1px solid rgba(0, 0, 0, 0.2); */
52+
height: 240px;
53+
padding: 20px 45px;
54+
}
55+
.block-card-item [name="height"] {
56+
contain: strict;
57+
}
58+
.block-content {
59+
height: 185px;
60+
padding: 30px;
61+
box-sizing: border-box;
62+
background: linear-gradient(180deg, var(--card-color), #fff);
63+
border-radius: 20px;
64+
/* box-shadow: -4px -4px 8px rgba(255, 255, 255, 0.2),
65+
4px 4px 8px rgba(0, 0, 0, 0.2); */
66+
/* filter: drop-shadow(-4px -4px 8px rgba(255, 255, 255, 0.2)) drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.2)); */
67+
}
68+
.block-card-item.last .chain-link {
69+
display: none;
70+
}
71+
.block-card-item.hide {
72+
display: none;
73+
}
74+
.chain-link {
75+
position: absolute;
76+
bottom: 0;
77+
left: 0;
78+
z-index: 2;
79+
height: 60px;
80+
width: 100%;
81+
/* opacity: 0.9; */
82+
display: flex;
83+
flex-direction: row;
84+
justify-content: space-around;
85+
}
86+
.chain-link::before,
87+
.chain-link::after {
88+
content: " ";
89+
width: 10px;
90+
background: #fff;
91+
/* box-shadow: -1px -1px 2px rgba(255, 255, 255, 0.2),
92+
1px 1px 2px rgba(0, 0, 0, 0.2); */
93+
border-radius: 5px;
94+
}
95+
.top-button {
96+
width: 100%;
97+
}
98+
.my-sliders {
99+
width: 100%;
100+
height: 100%;
101+
padding: 10px;
102+
box-sizing: border-box;
103+
}
104+
.my-sliders .slider-item {
105+
background-color: #e91e63;
106+
width: 100%;
107+
height: 100%;
108+
border-radius: 10px;
109+
display: flex;
110+
align-items: center;
111+
justify-content: center;
112+
}
113+
</style>
10114
<script>
11-
function rangeChange(event) {
115+
function rangeChange(event) {
116+
const { entries } = event.detail;
12117
for (const { node, index, type } of entries) {
13-
if (type == "create" || type == "visible") {
118+
if (type == "create" || type == "visible") {
14119
// console.log("%s %c%s", viewClass, "color:green", type, index);
15120
const height = (this.l.itemCount - index).toString();
16121
const heightEle = node.querySelector("[name=height]");
17122
if (heightEle.textContent != height) {
18-
(heightEle.firstChild || heightEle).textContent = height;
19-
node.style.setProperty("z-index", height);
123+
(heightEle.firstChild || heightEle).textContent = height;
124+
node.style.setProperty("z-index", height);
20125
}
21126
node.classList.toggle("last", height === "1" || index === 1n);
22127
console.log(index);
23128
node.classList.toggle("hide", index === 2n);
24129
// node.querySelector("[name=offsetTop]").innerHTML = node.offsetTop;
25-
}
26130
}
27-
}
131+
}
132+
}
28133
</script>
29134
<next-code-block></next-code-block>
30135
</template>
@@ -52,12 +157,12 @@
52157
</div>
53158
<custom-list-item item-size="400">
54159
<div class="my-sliders">
55-
<div class="slider-item"></div>
160+
<div class="slider-item">This is Banner!</div>
56161
</div>
57162
</custom-list-item>
58163
<custom-list-item position-top="812" item-size="200">
59164
<div class="my-sliders">
60-
<div class="slider-item"></div>
165+
<div class="slider-item">rethink, this is grid.</div>
61166
</div>
62167
</custom-list-item>
63168
</fixed-size-list>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bfchain/virtual-scroll",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"main": "dist/virtual-scroll.es.js",
55
"exports": {
66
".": "./dist/virtual-scroll.es.js"

0 commit comments

Comments
 (0)