prvni várka
This commit is contained in:
9
codebox/index.html
Normal file
9
codebox/index.html
Normal file
@ -0,0 +1,9 @@
|
||||
<body>
|
||||
<div class="code-box">
|
||||
<pre id="code-content">
|
||||
Místo pro kód (s kódem je možné manipulovat a tak i zůstame)
|
||||
</pre
|
||||
>
|
||||
<button id="copy-button">Kopírovat</button>
|
||||
</div>
|
||||
</body>
|
10
codebox/script.js
Normal file
10
codebox/script.js
Normal file
@ -0,0 +1,10 @@
|
||||
// Code-box
|
||||
document.getElementById("copy-button").addEventListener("click", function () {
|
||||
var codeContent = document.getElementById("code-content");
|
||||
var range = document.createRange();
|
||||
range.selectNode(codeContent);
|
||||
window.getSelection().removeAllRanges();
|
||||
window.getSelection().addRange(range);
|
||||
document.execCommand("copy");
|
||||
window.getSelection().removeAllRanges();
|
||||
});
|
24
codebox/style.css
Normal file
24
codebox/style.css
Normal file
@ -0,0 +1,24 @@
|
||||
/* CodeBox */
|
||||
|
||||
.code-box {
|
||||
position: relative;
|
||||
width: 500px;
|
||||
height: auto;
|
||||
border: 1px solid #734f96;
|
||||
padding: 5px;
|
||||
overflow: auto;
|
||||
background-color: #313131;
|
||||
color: yellowgreen;
|
||||
margin: auto;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#copy-button {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
cursor: pointer;
|
||||
color: whitesmoke;
|
||||
background-color: transparent;
|
||||
border: 1px solid #734f96;
|
||||
}
|
Reference in New Issue
Block a user