Last active
December 23, 2020 04:03
-
-
Save manngo/e88e769b1911fc694207888f3e52b9e1 to your computer and use it in GitHub Desktop.
Untitled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| font-family: sans-serif; | |
| } | |
| ul#tabs { | |
| list-style-type: none; | |
| display: flex; | |
| flex-direction: row; | |
| padding: 1em; | |
| border: thin solid #ccc; | |
| box-sizing: border-box; | |
| } | |
| ul#tabs>li { | |
| border: thin solid #ccc; | |
| padding: .5em; | |
| box-sizing: border-box; | |
| } | |
| li[draggable] { | |
| background-color: #f8f8f8; | |
| cursor: move; | |
| user-select: none; | |
| } | |
| ul#tabs>li.dragging { | |
| border-color: red; | |
| } | |
| ul#tabs>li.dragover-before { | |
| border-left: thick solid red; | |
| } | |
| ul#tabs>li.dragover-after { | |
| border-right: thick solid green; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <ul id="tabs"> | |
| <li>Apple</li> | |
| <li>Banana</li> | |
| <li>Cherry</li> | |
| <li>Date</li> | |
| <li>Elderberry</li> | |
| </ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.querySelectorAll('span.handle').forEach(span=>{ | |
| doStretch(span) | |
| }); | |
| function doStretch(span) { | |
| span.addEventListener('mousedown',stretch); | |
| var previous=span.previousElementSibling; | |
| var next=span.nextElementSibling; | |
| function stretch(event) { | |
| var width=parseInt(getComputedStyle(previous).width); | |
| var x=event.clientX; | |
| document.addEventListener('mousemove',goHorizontal); | |
| document.addEventListener('mouseup',stop); | |
| function goHorizontal(event) { | |
| previous.style.width=width+event.clientX-x+'px'; | |
| previous.style.pointerEvents=next.style.pointerEvents='none'; | |
| } | |
| function stop(event) { | |
| document.removeEventListener('mousemove',goHorizontal); | |
| document.removeEventListener('mouseup',stop); | |
| previous.style.pointerEvents=next.style.pointerEvents='auto'; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"view":"split","fontsize":"100","seethrough":"","prefixfree":"","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment