gsap+Draggable实现响应式可缩放拖动窗体对话框效果代码

代码语言:html

所属分类:拖放

代码描述:gsap+Draggable实现响应式可缩放拖动窗体对话框效果代码,拖动右下角缩放键,改变窗体大小,内部小蛇也改变形态。

代码标签: gsap Draggable 响应式 缩放 拖动 窗体 对话框

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">





    <style>
        * {
          box-sizing: border-box;
        }
        body {
          display: grid;
          background: #d9d9d9;
          place-items: center;
          min-height: 100vh;
        }
        .dialog {
          overflow: hidden;
          resize: horizontal;
          min-width: 20vmin;
          max-width: calc(50vmin + 0.5rem);
          position: absolute;
          padding: 0;
          border-width: 0.25rem;
          border-radius: 2vmin 2vmin 0 0;
        }
        .dialog__header {
          height: 44px;
          background: #404040;
          border-bottom: 0.25rem solid #000;
          z-index: 2;
          display: flex;
          align-items: center;
          justify-content: flex-start;
          padding: 0 1rem;
          gap: 0.5rem;
        }
        svg {
          width: 50vmin;
          max-width: 50vmin;
          aspect-ratio: 1;
        }
        .dialog__control {
          height: 40%;
          background: var(--bg, #f00);
          aspect-ratio: 1;
          border-radius: 50%;
        }
        .dialog__control--exit {
          --bg: #f2330d;
        }
        .dialog__control--minimize {
          --bg: #fa0;
        }
        .dialog__control--maximize {
          --bg: #19e619;
        }
    </style>



</head>

<body>
    <dialog class="dialog" open="open">
        <div class="dialog__header">
            <div class="dialog__control dialog__control--exit"></div>
            <div class="dialog__control dialog__control--minimize"></div>
            <div class="dialog__control dialog__control--maximize"></div>
        </div>
        <svg class="snek" viewbox="0 0 500 500" fill="none" xmlns="http://www.w3.org/2000/svg">
    <marker id="tail" viewbox="0 0 36 20" refx="35" refy="10" markerunits="strokeWidth" orient="auto" markerwidth="10" markerheight="1"&g.........完整代码请登录后点击上方下载按钮下载查看

网友评论0