Features
- No dependencies. One script and one stylesheet, about 15 KB zipped.
- Accessible. Keyboard controls, screen-reader labels, and reduced-motion support.
- Touch-ready. Swipe, pinch-to-zoom, and phones held sideways.
- Full-featured. Captions, thumbnails, fullscreen, and auto-advance.
- Scriptable. Add images on the fly, and
tmtgRun()loads them into the gallery. - Light on memory. Loads only the current image and two on either side.
- 12 languages. Control labels follow your page’s language.
- Secure. Works with a strict Content Security Policy and Trusted Types.
- Easy to restyle. Colors, corners, and aspect ratio are CSS variables.
- Free! Open source, under the MIT License.
Installation
- Copy
tmtg-1.3.2.min.jsandtmtg-1.3.2.min.cssinto the same folder on your site. - Load the script in your page’s
<head>, and list your images:
<script src="tmtg-1.3.2.min.js"></script>
<div class="tmtgContainer" id="tmtgContainer">
<div class="tmtgGallery" id="tmtgGallery">
<img src="data:," data-src="photo1.jpg"
alt="Short description"
data-description="Optional caption">
</div>
</div>
That’s it. For options and styling, see the quick start or the full documentation.
What’s new
v1.3.2 — Website update
- new website
- docs updated, converted to html
LICENSErenamed toLICENSE.txt
v1.3.1 — Bugfix
- data-src images now validate, with
src="data:,"placeholder
Earlier versions are in the full release notes.