diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-09 18:52:23 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-09 18:52:23 +0800 |
| commit | c7f405be1874b6fee1fd9674dea3208e19aab2ce (patch) | |
| tree | 8b2d4976e7a08ad0e8ed22d286c0d9f2bd58497b | |
| parent | 7bbf4f35d28f2dc0ca1fa31fe156f28f82b61703 (diff) | |
docs: add example about new layout
| -rw-r--r-- | README.md | 22 | ||||
| -rw-r--r-- | src/css/dumbymap.css | 14 |
2 files changed, 30 insertions, 6 deletions
| @@ -126,14 +126,24 @@ After `generateMaps()`, the container has the following structure: | |||
| 126 | 126 | ||
| 127 | Dumbymap switch layouts by attribute `data-layout` of container. Most of the features are done by pure CSS. | 127 | Dumbymap switch layouts by attribute `data-layout` of container. Most of the features are done by pure CSS. |
| 128 | 128 | ||
| 129 | You can add custom layout by options `layouts`: | 129 | You can add custom layout by options `layouts`. For example, the following code add a new layout `sticky` to stick `Showcase` at bottom right corner: |
| 130 | |||
| 131 | ```css | ||
| 132 | .Dumby[data-layout='sticky'] { | ||
| 133 | .Showcase { | ||
| 134 | display: block; | ||
| 135 | width: 20vw; | ||
| 136 | height: 40vh; | ||
| 137 | position: absolute; | ||
| 138 | right: 0; | ||
| 139 | bottom: 0; | ||
| 140 | background: red; | ||
| 141 | } | ||
| 142 | } | ||
| 143 | ``` | ||
| 130 | 144 | ||
| 131 | ```js | 145 | ```js |
| 132 | generateMaps(container, { | 146 | generateMaps(container, { layouts: "sticky" }) |
| 133 | layouts: [ | ||
| 134 | "LAYOUT-NAME" | ||
| 135 | ] | ||
| 136 | }) | ||
| 137 | ``` | 147 | ``` |
| 138 | 148 | ||
| 139 | 149 | ||
diff --git a/src/css/dumbymap.css b/src/css/dumbymap.css index 19e3baf..d31d7e6 100644 --- a/src/css/dumbymap.css +++ b/src/css/dumbymap.css | |||
| @@ -781,3 +781,17 @@ a[href^='http']:not(:has(img))::after, | |||
| 781 | opacity: 0.3; | 781 | opacity: 0.3; |
| 782 | } | 782 | } |
| 783 | } | 783 | } |
| 784 | |||
| 785 | .Dumby[data-layout='sticky'] { | ||
| 786 | .Showcase { | ||
| 787 | display: block; | ||
| 788 | width: 20vw; | ||
| 789 | height: 40vh; | ||
| 790 | |||
| 791 | position: absolute; | ||
| 792 | right: 0; | ||
| 793 | bottom: 0; | ||
| 794 | |||
| 795 | background: red; | ||
| 796 | } | ||
| 797 | } | ||