Skip to content

Commit

Permalink
added modal for demo gif
Browse files Browse the repository at this point in the history
  • Loading branch information
GwenTastic committed May 7, 2024
1 parent 6bddcb0 commit b00481f
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 3 deletions.
6 changes: 6 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<![endif]-->
</head>
<body class="container">

<div id="modal">
<div id="modal-content">

</div>
</div>
<header>
<h1 class="header">{{ site.title | default: site.github.repository_name }}</h1>
<p class="header">{{ site.description | default: site.github.project_tagline }}</p>
Expand Down
43 changes: 43 additions & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,47 @@ blockquote.warning {
background-color: var(--dark-purple-trans);
border: medium double var(--light-purple);
padding: 5px 5px 5px 10px;
}

#modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
}

#modal-content {
background-color: #fefefe;
margin: 15% auto;
padding: 20px;
border: 1px solid #888;
width: 90%;
background-repeat: no-repeat;
}

.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}

.close:hover, .close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}

#modal-content img.demo {
max-width: unset;
max-height: unset;
width: 100%;
margin: unset;
padding: unset;
}
46 changes: 43 additions & 3 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,46 @@ Once you are done setting up the rules you can hit the red `Separate Passages!`


## Showcase:
Here's an example workflow

<img class="demo" src="assets/images/TweeFileSplitter_demo_1.gif"/>
Here's an example workflow (left mouse click to enlarge)
<span id="preview-image">
<img class="demo" src="assets/images/TweeFileSplitter_demo_1.gif"/>
</span>

<script defer>
setTimeout(function() {
let modal = document.getElementById("modal");
let image = document.getElementById("preview-image");
console.log(image);
//var span = document.getElementsByClassName("close")[0];

// When the user clicks on the button, open the modal
console.log("setup image clicked");
image.addEventListener("click", function(e) {
console.log("clicked");
let modal = document.getElementById("modal");
let content = document.getElementById("modal-content");
let img = document.querySelector("#preview-image img");
console.log(img);
modal.style.display = "block";
content.replaceChildren(img);
// content.style.backgroundImage = `url("${img.src}")`;
});

// When the user clicks on <span> (x), close the modal
// span.onclick = function() {
// modal.style.display = "none";
// }

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
let img = document.querySelector("#modal-content img");
// let content = document.getElementById("");
let content = document.getElementById("preview-image");

content.replaceChildren(img);
modal.style.display = "none";
}
}
}, 1000);
</script>

0 comments on commit b00481f

Please sign in to comment.