|
6 | 6 | ```html |
7 | 7 | <custom-element-demo> |
8 | 8 | <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> |
10 | 114 | <script> |
11 | | - function rangeChange(event) { |
| 115 | + function rangeChange(event) { |
| 116 | + const { entries } = event.detail; |
12 | 117 | for (const { node, index, type } of entries) { |
13 | | - if (type == "create" || type == "visible") { |
| 118 | + if (type == "create" || type == "visible") { |
14 | 119 | // console.log("%s %c%s", viewClass, "color:green", type, index); |
15 | 120 | const height = (this.l.itemCount - index).toString(); |
16 | 121 | const heightEle = node.querySelector("[name=height]"); |
17 | 122 | 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); |
20 | 125 | } |
21 | 126 | node.classList.toggle("last", height === "1" || index === 1n); |
22 | 127 | console.log(index); |
23 | 128 | node.classList.toggle("hide", index === 2n); |
24 | 129 | // node.querySelector("[name=offsetTop]").innerHTML = node.offsetTop; |
25 | | - } |
26 | 130 | } |
27 | | - } |
| 131 | + } |
| 132 | + } |
28 | 133 | </script> |
29 | 134 | <next-code-block></next-code-block> |
30 | 135 | </template> |
|
52 | 157 | </div> |
53 | 158 | <custom-list-item item-size="400"> |
54 | 159 | <div class="my-sliders"> |
55 | | - <div class="slider-item"></div> |
| 160 | + <div class="slider-item">This is Banner!</div> |
56 | 161 | </div> |
57 | 162 | </custom-list-item> |
58 | 163 | <custom-list-item position-top="812" item-size="200"> |
59 | 164 | <div class="my-sliders"> |
60 | | - <div class="slider-item"></div> |
| 165 | + <div class="slider-item">rethink, this is grid.</div> |
61 | 166 | </div> |
62 | 167 | </custom-list-item> |
63 | 168 | </fixed-size-list> |
|
0 commit comments