miromannino/Justified-Gallery
소개
고품질 정렬형 이미지 갤러리를 만들 수 있도록 돕는 JavaScript 라이브러리입니다. 수천 개의 웹사이트와 사진 커뮤니티 500px에서 사용됩니다.
디자인 및 미디어측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 0
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
Justified Gallery is a JavaScript library that allows you to create an high quality justified gallery of images.
Usage
import { JustifiedGallery } from "justified-gallery";
import "justified-gallery/style.css";
const gallery = document.getElementById("gallery");
const jg = new JustifiedGallery(gallery);
jg.init();
// later, on unmount:
jg.destroy();
JustifiedGallery is a plain class working against a real HTMLElement, so it
integrates the same way in any framework: get a ref to the container, call
init() once it's mounted, and call destroy() on cleanup. See
test/browser/html/react_gallery.tsx and
test/browser/html/vue_gallery.vue for
working React and Vue examples.
The stylesheet keeps entries hidden until they're positioned, so you don't see a
flash of raw, unpositioned images. This only applies inside a container with the
justified-gallery class, since that's what the CSS targets:
.justified-gallery > a,
.justified-gallery > div,
.justified-gallery > figure {
opacity: 0;
/* ... */
}
init() adds that class for you, but not until your script runs. So the hiding
won't actually happen before then unless you also add the class yourself,
directly in your markup:
<div id="gallery" class="justified-gallery">...</div>
init() adding the class again is harmless; destroy() still removes it.
This also depends on the CSS itself being loaded before your script runs. The
import "justified-gallery/style.css" above takes care of that for bundler
setups (bundlers usually put CSS imports into a <link> that loads ahead of
your JS). If you're loading the library from a plain <script> tag or CDN with
no build step, link the stylesheet the same way, directly in <head>, before
your script tag:
<link
rel="stylesheet"
href="https://.../justified-gallery/dist/assets/justified-gallery.css"
/>
Contributing
Prerequisites:
- Node.js
npm installto install all dependencies.
Develop:
npm run devstarts a Vite dev server againsttest/browser, serving the source directly (no build step needed while iterating). In this mode/text/browser/htmlpages can be explored. These are the same pages used by the e2e tests.
Build:
npm run buildcompiles the library for distribution: bundlessrc/justified-gallery.tswith Vite intodist/justified-gallery.jsanddist/assets/justified-gallery.css, and emits type declarations (dist/*.d.ts) withtsc.npm run previewserves the builtdistoutput locally.
Test:
npm testruns the full suite (unit tests, then browser/e2e tests).npm run test:unitruns the Vitest unit tests intest/unit.npm run test:e2eruns the Playwright browser tests intest/browser.
Try the built package as a real npm dependency:
scripts/test-local-package.shbuilds the library,npm links it, and links/serves it fromsandbox-consumer/(a throwaway, gitignored Vite project) — useful to confirm the published package resolves and works the way a downstream consumer would experience it.
관련 프로젝트 살펴보기
불러오는 중…