Module for creating galleries with re-ordering https://codepen.io/mirzaev-sexy/pen/RNPdYvv
Go to file
Arsen Mirzaev Tatyano-Muradovich 9ff10d8d21 added large gif 3 2025-07-03 17:28:20 +07:00
assets large file demonstration 2025-07-03 17:24:13 +07:00
LICENSE Initial commit 2025-06-30 22:27:35 +07:00
README.md added large gif 3 2025-07-03 17:28:20 +07:00
gallery.mjs wrap.target -> wrap 2025-07-03 06:42:02 +07:00
gallery.mjs.min wrap.target -> wrap 2025-07-03 06:42:32 +07:00
index.css updated column width calculation 2025-07-01 22:14:11 +07:00

gallery.mjs

Module for creating galleries with re-ordering

Example

<section id="wrap">
  <label for="images" class="unselectable">
    Choose images
    <input id="images" type="file" name="images" accept="image/png, image/jpeg, image/webp" multiple="true" onchange="document.getElementById('wrap')?.gallery.import(this.files)" />
  </label>
  <button id="reset" onclick="document.getElementById('wrap')?.gallery.ascending()">Reset</button>

  <label id="loader" for="images" class="unselectable">Empty</label>
  <div id="gallery"></div>

  <span id="order" class="unselectable">Order:</div>
</section>
import("/js/modules/gallery.mjs").then((module) => {
  // Initializing the instance
  new module.gallery(
    document.getElementById("wrap"),
    document.getElementById("images"),
    document.getElementById("gallery"),
    true
  );
});

CSS in the /index.css file

Demonstration

CodePen


Demonstration image Demonstration gif Demonstration gif