In this article, we will learn how to implement an image gallery feature using JavaScript Gallery plugin. This plugin is very light-weight and responsive in nature which helps developers for managing photo galleries.
Note: Please download the JavaScript Gallery plugin in the working folder and include the required files in the head section of your HTML code.
<link href=”style.css” rel=”stylesheet” type=”text/css”/>
<script src=”app.js”></script>
Example: The following example demonstrates an image gallery using the JavaScript Gallery plugin. Each image in the gallery is easily swipeable. The developer needs to create one “images” folder in the working folder in which the “JPG” or “PNG” images files are stored. More images can be added later in this folder.
HTML
<!DOCTYPE html> <html lang="en"> <meta charset="utf-8"> <meta name="viewport" content= "initial-scale=1, width=device-width"> <head> <link rel="stylesheet" href="style.css"> <script src="app.js" type="module"></script> <title>JavaScript Gallery Plugin</title> <style> body { text-align: center; } </style> </head> <body> <h2 style="color:green">GeeksForGeeks</h2> <b>JavaScript Gallery Plugin</b> <template> <li> <img alt="" loading="lazy"> </li> </template> </body> </html> |
images.js This JavaScript file is used in the above HTML code which holds all the images name as shown below.
export default [ "background1.jpg", "background2.jpg", "background3.jpg", "geeksimage1.png", "geeksimage2.png", "geeksimage3.png", "gfg1.png" ]; |
Output:

If the user wants to add more images to the gallery, the new image name should be added as shown below in the code. For example “gfg2.jpg” is the file added in the “images” folder and in the following code.
export default [ "background1.jpg", "background2.jpg", "background3.jpg", "geeksimage1.png", "geeksimage2.png", "geeksimage3.png", "gfg1.png", "gfg2.jpg" ]; |
Output: The following output shows the responsive nature of the plugin.

Recommended Posts:
- jQuery | Flipping Gallery Plugin
- How to add filter with Portfolio Gallery using HTML, CSS and JavaScript ?
- How to Create Image Lightbox Gallery using HTML CSS and JavaScript ?
- How to preview Image on click in Gallery View using HTML, CSS and JavaScript ?
- CSS | Image Gallery
- How to Create a Tab Image Gallery ?
- How to create a Portfolio Gallery using HTML and CSS ?
- How to create responsive image gallery using HTML, CSS, jQuery and Bootstrap?
- Google AMP amp-lightbox-gallery
- Modal JavaScript plugin (bootstrap) with example
- JavaScript ScrollLoopMenu Plugin
- JavaScript RapidLayersAnimation Plugin
- JavaScript Structured-Filter Plugin
- JavaScript MagneticButtons Plugin
- jQuery | Page Piling Plugin
- Step by step guide to make your first Wordpress Plugin
- jQuery | Mask Plugin
- How to create a jQuery plugin with methods?
- jQuery | Multiscroll Plugin
- jQuery | DrawSVG Plugin
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


