Sha256: 2926b1a315023ad96a852201084457e7897ba74a35cf07aec6715db970eabbfc
Contents?: true
Size: 693 Bytes
Versions: 17
Compression:
Stored size: 693 Bytes
Contents
import { CocoComponent } from "@js/coco"; export default CocoComponent("modalLightbox", () => { return { loaded: false, init() { if (this.img.complete && this.img.naturalHeight !== 0) { this.imageLoaded(); } }, close() { this.modal.hide(); }, imageLoaded() { this.loaded = true; setTimeout(() => { const scrollTop = parseInt(this.img.dataset.scrollTop, 10); if (!isNaN(scrollTop) && scrollTop !== 0) { this.modal.scrollTo(scrollTop); } }, 200); }, get img() { return this.$refs.media.querySelector("img"); }, root: { ":class": "{loaded}", }, }; });
Version data entries
17 entries across 17 versions & 1 rubygems