JSFiddle - React, Tailwind, and code Playground
by Snj
HTML
<a href="javascript:void(0)" class="openbtn" onclick="openNav()">⍽</a>
<div id="myNav" class="overlay">
<div id="inputSlider">
<input type="range" id="range" min="50" max="500" value="155">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
</div>
<div class="myInfo"><button class="checkButton">Run/Check</button>
<input type="checkbox" class="mycheckbox checkButton" id="scrollreverse" name="scrollreverse" value="reverse">
<label for="scrollreverse">Reversed</label>
</div>
<div class="overlay-content">
<div class="mycontainer">
</div>
</div>
</div>
CSS
:root {
--size: 155px;
}
.myInfo {
text-align: center;
margin-bottom: -1rem;
}
.mycheckbox {
margin-left: 1em;
display: inline-block;
height: 19px;
vertical-align: bottom;
position: relative;
top: -1px;
}
.checkButton {
background: #6f6f6fab;
box-shadow: 0px 0px 6px #ffffffb0;
border-radius: 5px;
border: #313131 solid 1px;
line-height: 1.1em;
font-size: large;
margin: 2em 0em 0em 0.4em;
}.checkButton:hover { box-shadow: 0px 0px 6px #8aff9fb0; cursor: pointer; }
#inputSlider{
text-align: center;
position: sticky;
opacity: 0.7;
padding: 0.5em;
display: grid;
top: 10px;
margin-left: 40px;
background: #22212191;
box-shadow: -3px 6px 11px rgba(132, 97, 97, 0.89), 3px 5px 11px rgba(0, 0, 0, 0.89), 7px 6px 11px rgba(132, 97, 97, 0.89);
width: calc(100% - 10rem);
z-index: 10;
--size: 155px;
}
.mycontainer {
padding: 0em 1em 1em 1em;
display: grid;
grid-gap: 1em;
font-family: monospace;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
/* Change "auto-fit" to "auto-fill" above to see the difference */
}
.mycontainer .img_div {
height: var(--size);
max-width: -moz-available;
object-fit: contain;
position: relative;
width: var(--size);
max-height: -moz-available;
}
.mycontainer .box {
box-shadow: 10px 9px 20px 0px rgba(0, 0, 0, 0.44);
max-width: max-content;
border-radius: 0.3em;
background: linear-gradient(0deg, rgba(253,187,45,0) 0%,
rgba(47,47,47,0.6983630770728702) 25%,
rgba(47,47,47,1) 37%,
rgba(47,47,47,1) 72%,
rgba(47,47,47,0.7043154580252511) 85%,
rgba(253,187,45,0) 100%);
}
.mycontainer .box p {
margin-top: 3px;
color: #666262;
}
.mycontainer .box span {
display: ruby;
font-weight: bold;
position: relative;
margin: 0.1rem 0rem;
color: #818181;
}
.mycontainer .box span :before {
content:...
JavaScript
$(".checkButton").on("click", populate );
$(document).keyup(function(e){ if(e.keyCode === 27) { closeNav(); } });
function openNav() {
$("#myNav").css("width", "100%");
$("body").css("overflow-y", "hidden");
$(".closebtn").show();
}
function closeNav() {
$("#myNav").css("width", "0%");
$("body").css("overflow-y", "auto");
$(".closebtn").hide();
}
range.addEventListener("input", function() {
document.body.style.setProperty("--size", this.value + "px");
});
var parser = document.createElement('a'), searchObject = {}, queries, split, i;
var baseTop = $("div#inputSlider").offset().top;
var current_url, current_page, end_page, next_pagenr, next_page;
var scrollstop = "0";
var regex = /(https?:[/|.|\w|\s|-]*\.(?:jpg|gif|png))/gmi;
var found_results = []
function populate() {
for (let image of found_results) {
var temp_box = $("<div class='box'></div>");
var temp_img = $("<img class='img_div' src="+image+">");
temp_box.append(temp_img);
$(".mycontainer").append(temp_box);
}
}