-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix case where load image starts as display: none
- Loading branch information
Showing
2 changed files
with
25 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css> | ||
<link rel=stylesheet href=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna-engine.css> | ||
<link rel=stylesheet href=../../dist/reset.min.css> | ||
<script defer src=https://cdn.jsdelivr.net/npm/[email protected]/dist/fetch-json.min.js></script> | ||
<script defer src=https://cdn.jsdelivr.net/npm/[email protected]/dist/dna-engine.min.js></script> | ||
<script defer src=../../dist/lib-x.min.js></script> | ||
<script>globalThis.onerror = () => globalThis.document.body.style.background = 'pink';</script> | ||
|
@@ -46,6 +47,13 @@ | |
globalThis.document.querySelectorAll('.montage-loop').forEach( | ||
holder => libX.animate.montageLoop(holder, { intervalMsec: 5000 })); | ||
}; | ||
const loadImage = (button) => { | ||
const img = button.parentElement.nextElementSibling; | ||
const handle = (data) => | ||
libX.ui.loadImageFadeIn(img, data.image, 5000).then(() => button.disabled = false); | ||
img.parentElement.dataset.imageReuested = String(Date.now()); | ||
fetchJson.get('https://yesno.wtf/api').then(handle); | ||
}; | ||
const handleHash = (container) => (hash) => container.querySelector('output').textContent = hash; | ||
const hashIt = (elem) => libX.crypto.hash(libX.dom.migrate(elem).value) | ||
.then(handleHash(libX.dom.migrate(elem).closest('div'))); | ||
|
@@ -102,6 +110,11 @@ <h2>Specifications</h2> | |
<img src=https://centerkey.com/paradise-galleries/console-demo/~data~/portfolio/004-small.png alt=montage> | ||
<img src=https://centerkey.com/paradise-galleries/console-demo/~data~/portfolio/019-small.png alt=montage> | ||
</aside> | ||
<aside style="width: 150px; background-color: white; border: none; padding: 0px;"> | ||
<p><button data-on-click=loadImage>Load</button></p> | ||
<img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPjwvc3ZnPg==" | ||
alt=placeholder> | ||
</aside> | ||
<p class=display-addr data-name=sales data-domain=ibm.com></p> | ||
<hr> | ||
<div> | ||
|