Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (() => {
- const iframe = document.createElement("iframe");
- iframe.setAttribute("allowfullscreen", "");
- iframe.setAttribute("allow", "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture");
- iframe.setAttribute("frameborder", "0");
- iframe.setAttribute("src", "https://www.youtube.com/embed/videoseries?list=PLIc1-wxSJgpPL3vusgP2D64sIw6P8F4gk");
- iframe.style.width = "560px";
- iframe.style.height = "315px";
- const div = document.createElement("div");
- div.style.position = "absolute";
- div.style.left = "0px";
- div.style.top = "0px";
- div.style.opacity = "0.5";
- div.style.borderTop = "20px solid";
- div.style.borderBottom = "20px solid";
- div.style.resize = "both";
- div.appendChild(iframe);
- document.body.appendChild(div);
- div.onmousedown = (eDown) => {
- var divX = parseFloat(div.style.left);
- var divY = parseFloat(div.style.top);
- var initialPointerX = eDown.clientX;
- var initialPointerY = eDown.clientY;
- div.onmousemove = (eMove) => {
- let movedPointerX = eMove.clientX - initialPointerX;
- let movedPointerY = eMove.clientY - initialPointerY;
- let movedDivX = divX+movedPointerX;
- let movedDivY = divY+movedPointerY;
- div.style.transform = "translate(" + movedPointerX + "px, " + movedPointerY + "px)";
- div.onmouseleave = () => {
- div.style.transform = "";
- div.style.left = movedDivX + "px";
- div.style.top = movedDivY + "px";
- div.onmousemove = null;
- div.onmouseup = null;
- div.onmouseleave = null;
- }
- div.onmouseup = () => {
- div.style.transform = "";
- div.style.left = movedDivX + "px";
- div.style.top = movedDivY + "px";
- div.onmousemove = null;
- div.onmouseup = null;
- div.onmouseleave = null;
- };
- };
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement