Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blair Englund #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,23 @@
</head>
<body>

<h1 id="header">Modal Window Demo</h1>

<input id="openbutton" type="button" name="Modal" value="Add note">

<div id="modalwrapper">
<div class="modal__background">
<div class="modal__content">
<textarea id="modal__text" placeholder="Enter note..."></textarea><br>
<div>
<input id="addbutton" type="button" name="Add" value="Add note">
<input id="cancelbutton" type="button" name="Cancel" value="Cancel">
</div>
</div>
</div>
</div>

<p id="displaynotes"></p>

</body>
</html>
32 changes: 31 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
// Replace me with your JavaScript!
window.addEventListener("load", function(argument) {

//button that brings up window
var openButton = document.getElementById('openbutton');

//button that submits note
var addButton = document.getElementById('addbutton');

//button that cancels submission
var cancelButton = document.getElementById('cancelbutton');

//modal window to hide/unhide
var modalWindow = document.getElementById('modalwrapper');

openButton.addEventListener('click', function(){
modalWindow.style.display = "block";
})

cancelbutton.addEventListener('click', function(){
modalWindow.style.display = "none";
document.getElementById('modal__text').value = null;
})

addButton.addEventListener('click', function(){
modalWindow.style.display = "none";
document.getElementById('displaynotes').innerHTML = document.getElementById('modal__text').value;
document.getElementById('modal__text').value = null;
})


});
33 changes: 32 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
/* Replace me with your styles! */
.modal__background{
background-color: #000;
opacity: 0.5;
margin-left: -8px;
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
z-index: 2;
display: flex;
justify-content: center;
align-items: center;
}

.modal__content{
background-color: #FFF;
opacity: 1.0;
display: flex;
flex-flow: column nowrap;
align-items: flex-end;
justify-content: center;
padding: 15px;
}

#modal__text{
height: 300px;
width: 500px;
}

#modalwrapper{
display: none;
}