BE AWARE !!!
I'M HIGHLY CUSTOMIZING MY PRODUCTION FLARUM SITE AND I PRESENT MY ADAPTATIONS TO SHOW HOW POWERFUL AND FLEXIBLE FLARUM IS
...BUT YOU MUST KNOW WHAT YOU DO AND ALL AT YOUR OWN RISK
I found the inspiration in this article and I modified the code according to my exigences
https://www.w3schools.com/howto/howto_css_modal_images.asp
STEP 1
I installed the wonderful Flagrow file upload extension and I thank him for his job
https://github.com/flagrow/flarum-ext-image-upload
STEP 2
I inserted a custom header with the simple javascript code and the needed html elements
<script type="text/javascript">
function clickHandler(e) {
var elm, evt = e ? e:event;
if (evt.srcElement) elm = evt.srcElement;
else if (evt.target) elm = evt.target;
if (elm.tagName.toUpperCase() == "IMG" && elm.parentElement.tagName.toUpperCase() == "P") {
var modal = document.getElementById("imgModal");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("imgCaption");
modal.style.display = "block";
modalImg.src = elm.src;
captionText.innerHTML = elm.alt;
}
return true;
}
document.onclick = clickHandler;
</script>
<div id="imgModal" class="imgModal">
<button id="imgClose" class="imgClose" type="button" onclick="document.getElementById('imgModal').style.display='none'">CLICK SULL'IMMAGINE E FRECCE PER SCORRERLA, CLICK QUI PER CHIUDERE</button>
<img id="img01" class="imgModal-content">
<div id="imgCaption"></div>
</div>
STEP 3
Then I added the plain css, always in customization section of my FLARUM site
/* MODAL POPUP IMAGES */
/* Style the Image Used to Trigger the Modal */
.Post-body > p img {
cursor: pointer;
transition: 0.5s;
}
.Post-body > p img:hover {
opacity: 0.5;
}
/* The Modal (background) */
.imgModal {
display: none;
position: fixed;
z-index: 2000;
padding-top: 100px;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.9);
}
/* Modal Content (Image) */
.imgModal-content {
z-index: 3000;
margin: auto;
display: block;
width: 100%;
}
/* Caption of Modal Image (Image Text) - Same Width as the Image */
#imgCaption {
margin: auto;
display: block;
width: 80%;
text-align: center;
color: #ccc;
padding: 10px 0;
height: 150px;
}
/* Add Animation - Zoom in the Modal */
.imgModal-content, #imgCaption {
-webkit-animation-name: zoom;
-webkit-animation-duration: 0.5s;
animation-name: zoom;
animation-duration: 0.5s;
}
@-webkit-keyframes zoom {
from {-webkit-transform:scale(0)}
to {-webkit-transform:scale(1)}
}
@keyframes zoom {
from {transform:scale(0)}
to {transform:scale(1)}
}
/* The Close Button */
.imgClose {
position: absolute;
top: 50px;
right: 50px;
z-index: 4000;
color: #000000;
background-color: #bababa;
font-size: 24px;
font-weight: bold;
transition: 0.5s;
}
.imgClose:hover,
.imgClose:focus {
color: #bababa;
background-color: #000000;
text-decoration: none;
cursor: pointer;
}
...and when the mouse passes over an image the cursor changes, the image becomes semi-transparent, click and you have a full screen popup with the close button
You can translate the button text as: "CLICK ON THE IMAGE AND USE THE ARROWS TO SCROLL, CLICK HERE TO CLOSE"
Feel free to visit and test my FLARUM PRODUCTION site (please use FLARUM TAG)
http://nova4x.com
https://nova4x.eu
And here the two shots of the mouse over an image and the following popup