Created
November 13, 2016 18:04
-
-
Save nexpr/d96a85648ee744790cc82fbe4e906c5f to your computer and use it in GitHub Desktop.
fullscreen drop supporter
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{ | |
| margin: 0; | |
| } | |
| .droparea{ | |
| all: initial; | |
| position: fixed; | |
| z-index: 1000; | |
| width: 100%; | |
| height: 100%; | |
| box-sizing: border-box; | |
| display: none; | |
| } | |
| .droparea.active{ | |
| display: block; | |
| border: 8px dashed purple; | |
| } |
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
| !function(){ | |
| var droparea = document.createElement("div") | |
| droparea.className = "droparea" | |
| function showDroparea(){ | |
| droparea.classList.add("active") | |
| } | |
| function hideDroparea(){ | |
| droparea.classList.remove("active") | |
| } | |
| droparea.ondragleave = eve => { | |
| eve.preventDefault() | |
| hideDroparea() | |
| } | |
| window.addEventListener("dragover", eve => eve.preventDefault(), false) | |
| window.addEventListener("dragenter", eve => { | |
| eve.preventDefault() | |
| showDroparea() | |
| }, false) | |
| window.addEventListener("drop", eve => { | |
| eve.preventDefault() | |
| hideDroparea() | |
| }, false) | |
| document.body.appendChild(droparea) | |
| }() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment