diff options
Diffstat (limited to 'src/dumbymap.mjs')
-rw-r--r-- | src/dumbymap.mjs | 8 |
1 files changed, 7 insertions, 1 deletions
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) |