

- #Bootstrap fluid image gallery how to
- #Bootstrap fluid image gallery code
- #Bootstrap fluid image gallery download
- #Bootstrap fluid image gallery free
The content div compose of three main parts, or sections, of the modal dialog. Dialog will contain another div with class “modal-content”. Inside this wrapper will be nested div with class “modal-dialog” and role attribute with value “document”. The structure of modal starts with the main wrapper div with classes “modal” and “fade”, id “modalPicture” and few more attributes for accessibility. The last piece of the HTML puzzle is modal dialog. Structure of the rectangle gallery cards:
#Bootstrap fluid image gallery free
However, feel free to use as many cards as you want, Masonry plugin will automatically take care about its distribution. As I mentioned, I used twelve cards (grid items). Next element, right after overlay div, second child of grid_item, will be img tag with src and alt attributes. There are also value and role attributes. I also used “js-button” class for later event handling and, styling classes from Bootstrap–“btn”, btn-secondary-outline” and “center-block”. The most important attributes for this button will be data-toggle with value “modal” and data-target with value “#modalPitcure” ( id of modal dialog).ĭ ata-toggle attribute tells bootstrap what type of element is the button triggering while data-target says exactly what element it is. Remember, you’ve got Masonry to handle the hard work for you.įirst child of every card will be div with class “item_overlay” containing button element to open modal dialog. Don’t worry about any issues with layout. One type for square cards and one for rectangle. This class will be later used by Masonry plugin to count the width of grid columns. The first card will have class “grid_sizer”. The only exception will be different src attributes for img elements. The whole grid will compose of twelve cards each featuring some image of your choice with class “grid_item”.

It will be this element where you will place the individual items that will populate the gallery, in this case cards with image thumbnails. Second child of the section will be div element with class “grid”. First child of section element will be header containing h1 tag with text “Masonry Gallery”. Third class is also from Bootstrap 4 and it changes the background color of section to “#f7f7f9” (very light grey). Second class is just for marking the gallery, but it will not be used. I used it to add small padding on the sides of the gallery. These building blocks will be inside section element with class of “container-fluid”, “gallery” and “bg-faded”.įirst class is from Bootstrap 4 (and 3) framework. grid_item for every image card and finally the modal dialog for larger version of image and some icons. These elements, or building blocks, are header with short title for the project. The whole structure is composed of four main elements. The first step, after gathering the dependencies you will need, is to create the HTML structure. In other words, you can copy, modify, distribute and use all of them as you wish.

These photos are licensed under Creative Commons Zero. Note: Images used in demo on Codepen and GitHub are provided by which is great source of high-quality photos. Second, you can use CDN and just include the links in your project.
#Bootstrap fluid image gallery download
First, you can download the assets described to your computer. I also customized the style with Font Awesome and font “Poiret One” from Google fonts.
#Bootstrap fluid image gallery code
Necessary assets are Bootstrap 4 stylesheet and JavaScript, source code for jQuery and Masonry plugin. The first thing you need to do is to get all the assets we are going to work with in this tutorial. You can see the gallery in action on Codepen and download all files from Github repository. I will also include links to demo and repository on GitHub where you can download the source code and use it on your website. That being said, this tutorial is suitable for people with wide range of knowledge, from complete beginner to professional. In this tutorial you will be working with HTML, CSS and jQuery.
#Bootstrap fluid image gallery how to
Today, you will learn about how to create an image gallery with Masonry grid system and Bootstrap 4 modals.
