A simple Javascript image gallery.
npm install tinygalleryA simple javascript image gallery.
!Demo
``console`
$ npm install tinygallery
Copy tinygallery.min.css and tinygallery.min.js from the /dist folder to your website. Alternatively, you can link to these files hosted on a CDN:
``
https://raw.githack.com/gyrad/tinygallery/master/dist/tinygallery.min.css
https://raw.githack.com/gyrad/tinygallery/master/dist/tinygallery.min.js
Include tinygallery.min.css in the head section of your webpage:
`html`
Include tinygallery.min.js at the bottom of the body of your webpage just before the closing
tag:`html`
Create a list of links to image files with enclosed thumbnails and add them to the body of your webpage. The root div MUST have class="tinygallery" and also an id set to a unique name. You can also add the data-caption attribute to show a caption underneath the image.
`html`
src="images/thumbnails/lhasa.jpg"
alt="Lhasa"
data-caption="A view of Lhasa, the capital of Tibet."
/>
![]()
src="images/thumbnails/tibet.jpg"
alt="Tibet"
data-caption="An aerial view of Tibet, the roof of the world."
/>
Add the following JavaScript code after including the tinygallery script, to initialize the gallery. Change the 'my_main_gallery' to the id of the div that contains the list of linked images.
`js``