JSFiddle - React, Tailwind, and code Playground

by von

HTML

var imgBtnClick = function (e) {
modal.style.display = "flex";
document.querySelector("#modal-image").src = e.target.dataset.image
window.scrollTo(0, document.querySelector("#scroll").offsetTop - window.innerHeight/2)
var newDiv = document.createElement("div")
newDiv.id = "newDiv"
newDiv.style.position = "absolute"
newDiv.style.top = ((document.body.scrollHeight/2)-(window.parent.window.innerHeight/2)).toString()+"px"
document.body.append(newDiv)
newDiv.scrollIntoView()
};