Advertisement
Guest User

yes2

a guest
Dec 15th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. (() => {
  2. const iframe = document.createElement("iframe");
  3. iframe.setAttribute("allowfullscreen", "");
  4. iframe.setAttribute("allow", "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture");
  5. iframe.setAttribute("frameborder", "0");
  6. iframe.setAttribute("src", "https://www.youtube.com/embed/videoseries?list=PLIc1-wxSJgpPL3vusgP2D64sIw6P8F4gk");
  7. iframe.style.width = "560px";
  8. iframe.style.height = "315px";
  9.  
  10. const div = document.createElement("div");
  11. div.style.position = "absolute";
  12. div.style.left = "0px";
  13. div.style.top = "0px";
  14. div.style.opacity = "0.5";
  15. div.style.borderTop = "20px solid";
  16. div.style.borderBottom = "20px solid";
  17. div.style.resize = "both";
  18. div.appendChild(iframe);
  19. document.body.appendChild(div);
  20. div.onmousedown = (eDown) => {
  21. var divX = parseFloat(div.style.left);
  22. var divY = parseFloat(div.style.top);
  23. var initialPointerX = eDown.clientX;
  24. var initialPointerY = eDown.clientY;
  25. div.onmousemove = (eMove) => {
  26. let movedPointerX = eMove.clientX - initialPointerX;
  27. let movedPointerY = eMove.clientY - initialPointerY;
  28. let movedDivX = divX+movedPointerX;
  29. let movedDivY = divY+movedPointerY;
  30. div.style.transform = "translate(" + movedPointerX + "px, " + movedPointerY + "px)";
  31. div.onmouseleave = () => {
  32. div.style.transform = "";
  33. div.style.left = movedDivX + "px";
  34. div.style.top = movedDivY + "px";
  35. div.onmousemove = null;
  36. div.onmouseup = null;
  37. div.onmouseleave = null;
  38. }
  39. div.onmouseup = () => {
  40. div.style.transform = "";
  41. div.style.left = movedDivX + "px";
  42. div.style.top = movedDivY + "px";
  43. div.onmousemove = null;
  44. div.onmouseup = null;
  45. div.onmouseleave = null;
  46. };
  47. };
  48. };
  49. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement