Skip to content

Instantly share code, notes, and snippets.

@moosetraveller
Created August 12, 2021 22:57
Show Gist options
  • Select an option

  • Save moosetraveller/1a2c6626e9d12c945f777da4ae4a2040 to your computer and use it in GitHub Desktop.

Select an option

Save moosetraveller/1a2c6626e9d12c945f777da4ae4a2040 to your computer and use it in GitHub Desktop.
Javascript: Draggable Panel

Make Panel Draggable

HTML

<div id="panelContainer">
    <div id="panelTitle">Title</div>
    <div id="panelBody">Body</div>
</div>

CSS

#panelContainer {
  position: fixed;
}
#panelTitle {
  cursor: move;
}

JavaScript

const panelContainer = document.getElementById("panelContainer");
const panelTitle = document.getElementById("panelTitle");

panelTitle.addEventListener("mousedown", dragStartEvent => {

  dragStartEvent.preventDefault();

  let x = dragStartEvent.clientX;
  let y = dragStartEvent.clientY;

  const onDrag = dragEvent => {

    dragEvent.preventDefault();

    const relX = x - dragEvent.clientX;
    const relY = y - dragEvent.clientY;

    x = dragEvent.clientX;
    y = dragEvent.clientY;

    panelContainer.style.top = `${panelContainer.offsetTop - relY}px`;
    panelContainer.style.left = `${panelContainer.offsetLeft - relX}px`;

  };

  const onDragFinished = _ => {
    document.removeEventListener("mouseup", onDragFinished);
    document.removeEventListener("mousemove", onDrag);
  }

  document.addEventListener("mouseup", onDragFinished);
  document.addEventListener("mousemove", onDrag);

});
@reinaldoriskowski463-sys
<title>URIEL XITER PANEL</title> <style> body{ background:#0a0a0a; font-family:Arial; color:white; overflow:hidden; } /* tela de login */ #login{ position:fixed; top:0; left:0; width:100%; height:100%; background:#000; display:flex; flex-direction:column; align-items:center; justify-content:center; } #login input{ padding:10px; border-radius:8px; border:none; margin-top:10px; } #login button{ padding:10px 20px; margin-top:10px; border:none; border-radius:8px; background:#00ffcc; cursor:pointer; } /* painel */ #panel{ display:none; position:fixed; top:120px; left:40px; width:300px; background:#111; border:2px solid #00ffcc; border-radius:15px; box-shadow:0 0 20px #00ffcc; padding:15px; } /* titulo */ #title{ text-align:center; font-size:20px; color:#00ffcc; margin-bottom:10px; text-shadow:0 0 10px #00ffcc; } .btn{ width:100%; padding:8px; margin:4px 0; border:none; border-radius:8px; background:#1c1c1c; color:white; cursor:pointer; } .btn:hover{ background:#00ffcc; color:black; } /* bola flutuante */ #ball{ display:none; position:fixed; top:70px; left:20px; width:45px; height:45px; background:#00ffcc; border-radius:50%; box-shadow:0 0 15px #00ffcc; cursor:pointer; } </style>

URIEL XITER LOGIN

Entrar
URIEL XITER PANEL

INJETAR

ESP PLAYER
ESP LINE
ESP BOX

AIM HEAD
AIM NECK
AIM CHEST

HS 100%
NO RECOIL
NO SPREAD

INVISÍVEL
IMORTAL
ATRAVESSAR PAREDE

<script> function entrar(){ let senha = document.getElementById("senha").value; if(senha == "55"){ document.getElementById("login").style.display="none"; document.getElementById("panel").style.display="block"; document.getElementById("ball").style.display="block"; }else{ alert("Senha errada!"); } } function togglePanel(){ let p = document.getElementById("panel"); if(p.style.display=="none"){ p.style.display="block"; }else{ p.style.display="none"; } } function inject(){ alert("Injetando código..."); setTimeout(()=>{ alert("Códigos injetados com sucesso!"); },5000); } </script>

@reinaldoriskowski463-sys

Qs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment