diff options
| author | xj9 <xj9@heropunch.io> | 2017-03-02 20:01:19 -0700 |
|---|---|---|
| committer | xj9 <xj9@heropunch.io> | 2017-03-02 20:01:19 -0700 |
| commit | 9107facaca414f5f3ea6cf5cb306fb0fa241e1bd (patch) | |
| tree | 9f24845d7fc73564e3b321a7220f65765381b385 /src | |
| parent | 6075915223e26fc0b535d87a3cdf26435245937e (diff) | |
issue #1 - better nsfw image loading
preload the image when it is toggled, but wait to replace it until
it has loaded.
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/attachment/attachment.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index f4f6aebf..c3f52f57 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -29,7 +29,11 @@ const Attachment = { } }, toggleHidden () { - this.showHidden = !this.showHidden + let img = document.createElement('img') + img.src = this.attachment.url + img.onload = () => { + this.showHidden = !this.showHidden + } } } } |
