diff options
-rw-r--r-- | src/css/dumbymap.css | 10 | ||||
-rw-r--r-- | src/dumbymap.mjs | 8 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/css/dumbymap.css b/src/css/dumbymap.css index b4689b9..591c9ec 100644 --- a/src/css/dumbymap.css +++ b/src/css/dumbymap.css | |||
@@ -397,6 +397,16 @@ | |||
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
400 | .dumby-block:has(pre:only-child [data-placeholder]:only-child) { | ||
401 | overflow: clip; | ||
402 | |||
403 | [data-placeholder] { | ||
404 | height: 50px !important; | ||
405 | scale: .9; | ||
406 | transition-duration: .4s; | ||
407 | transition-timing-function: ease-out; | ||
408 | } | ||
409 | } | ||
400 | 410 | ||
401 | .bold-options { | 411 | .bold-options { |
402 | font-weight: bold; | 412 | font-weight: bold; |
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs index 9665c9c..42a507f 100644 --- a/src/dumbymap.mjs +++ b/src/dumbymap.mjs | |||
@@ -250,9 +250,15 @@ export const generateMaps = async (container, callback) => { | |||
250 | // Placeholder for map in Showcase, it should has the same DOMRect | 250 | // Placeholder for map in Showcase, it should has the same DOMRect |
251 | const placeholder = target.cloneNode(true) | 251 | const placeholder = target.cloneNode(true) |
252 | placeholder.classList.remove('map-container') | 252 | placeholder.classList.remove('map-container') |
253 | placeholder.setAttribute('data-placeholder', target.id) | ||
254 | target.parentElement.replaceChild(placeholder, target) | 253 | target.parentElement.replaceChild(placeholder, target) |
255 | 254 | ||
255 | // HACK Trigger CSS transition, if placeholde is the olny chil element in block, | ||
256 | // reduce its height to zero. | ||
257 | // To make sure the original height of placeholder is applied, callBoundingClientRect() seems work(Why?). | ||
258 | // then set data-attribute for CSS selector to change height to 0 | ||
259 | placeholder.getBoundingClientRect() | ||
260 | placeholder.setAttribute('data-placeholder', target.id) | ||
261 | |||
256 | // To fit showcase, remove all inline style | 262 | // To fit showcase, remove all inline style |
257 | target.removeAttribute('style') | 263 | target.removeAttribute('style') |
258 | showcase.appendChild(target) | 264 | showcase.appendChild(target) |