Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- .modal {
- display: none;
- position: fixed;
- z-index: 1;
- 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.7);
- }
- .modal-content {
- position: relative;
- background-color: #ffffff;
- margin: auto;
- padding: 0;
- border: 1px solid #888;
- width: 80%;
- box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
- -webkit-animation-name: animatetop;
- -webkit-animation-duration: 0.4s;
- animation-name: animatetop;
- animation-duration: 0.4s
- }
- @-webkit-keyframes animatetop {
- from {bottom:-300px; opacity:0}
- to {top:0; opacity:1}
- }
- @keyframes animatetop {
- from {bottom:-300px; opacity:0}
- to {top:0; opacity:1}
- }
- .close {
- color: white;
- float: right;
- font-size: 28px;
- font-weight: bold;
- }
- .close:hover,
- .close:focus {
- color: #000;
- text-decoration: none;
- cursor: pointer;
- }
- .modal-header {
- background: red; /* For browsers that do not support gradients */
- background: -webkit-linear-gradient(red, yellow); /* For Safari 5.1 to 6.0 */
- background: -o-linear-gradient(red, yellow); /* For Opera 11.1 to 12.0 */
- background: -moz-linear-gradient(red, yellow); /* For Firefox 3.6 to 15 */
- background: linear-gradient(red, yellow); /* Standard syntax */
- }
- .modal-body {padding: 2px 16px;}
- .modal-footer {
- padding: 2px 16px;
- background-color: #5cb85c;
- color: white;
- }
- </style>
- </head>
- <body>
- <button id="myBtn">knopka</button>
- <div id="myModal" class="modal">
- <div class="modal-content">
- <div class="modal-header">
- <span class="close">×</span>
- <h1>golova<h1>
- </div>
- <div class="modal-body">
- <p>telo</p>
- </div>
- <div class="modal-footer">
- <h2>nogi</h2>
- </div>
- </div>
- </div>
- <script>
- var modal = document.getElementById('myModal');
- var btn = document.getElementById("myBtn");
- var span = document.getElementsByClassName("close")[0];
- btn.onclick = function() {
- modal.style.display = "block";
- }
- span.onclick = function() {
- modal.style.display = "none";
- }
- window.onclick = function(event) {
- if (event.target == modal) {
- modal.style.display = "none";
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement