diff options
| author | Eltrac <hi@guhub.cn> | 2025-09-15 16:18:14 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-09-15 16:18:14 +0800 |
| commit | d80586e1bb1e8c9f9c0f54d7b65b2c81b4cf1413 (patch) | |
| tree | 859baafcf21e01a5c61a1755320313ec173a9ddb | |
| parent | 050d6b730640ed095c9f98ef63d930215e5d43ad (diff) | |
docs: create README.md
| -rw-r--r-- | README.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..8e54da2 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# ♎️ Libra.js + +A lightweight, focused, vanilla JavaScript image lightbox library, only around **3.3KB** after minified. + +## Usage + +Grab [libra.min.js](https://github.com/BigCoke233/libra/blob/master/dist/libra.min.js) and put it in your project. + +Then import it as a module: + +```html +<script type="module"> + import LightBox from '/dist/libra.min.js'; + const lightbox = new LightBox({ + container: '.libra' // where your images are contained + // e.g. if your post content is in a div with class "post-content" + // then you can set container: '.post-content' + }); +</script> +``` + +Also, include [libra.css](https://github.com/BigCoke233/libra/blob/master/src/libra.css). + +```html +<link rel="stylesheet" href="/src/libra.css" /> +``` + +## Development + +``` +npm install +npm run test +``` + +The `test` command runs Parcel in watch mode. + +## Why? + +I've been using [Fancybox](https://fancyapps.com/fancybox/) for a long time. While it is an excellent library, it also includes lots of features I don't need. After searching available alternatives, I found most of them either not well maintained or just as heavy. So I developed Libra.js for my own use, and I hope you find it useful, too! |
