I've been trying to make a dynamically generated content, a simple gallery using Owl Carousel from Imgur API in a centered modal.
This is basic HTML structure:
<article id="XYZ">
<figure class="cover">
<img src="http://i.imgur.com/XYZ1234.jpg">
</figure>
</article>
The API is consumed when a <figure>
is clicked, generating Owl Carousel's markup, with all images, e.g:
<div id="gallery" class="ow-carousel">
<div class="item">
<img class="lazyOwl" data-src="http://i.imgur.com/XYZ1234.jpg" />
</div>
<div class="item">
<img class="lazyOwl" data-src="http://i.imgur.com/XYZ4567.jpg" />
</div>
<div class="item">
<img class="lazyOwl" data-src="http://i.imgur.com/ABC789.jpg" />
</div>
</div>
I would like to make this #gallery instead of being visibly generated, in this case below the cover photo, to open centered like a modal and when any of the <img>
inside the gallery is clicked, the modal is closed.
The result I expect, as much simple as possible and most important, mobile-friendly, is to have the gallery occupying the whole viewport of the smartphone (mandatory) or, if viewing from desktop browser, centered, with the usual background overlay.
Although I know this might be simple, I'm struggling more than I should.