dialog-draggable
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Dialog-draggable

Downloads Version License

Makes the HTML element <dialog> draggable.

Live demo

Quick start

Install

pnpm add dialog-draggable
# yarn add dialog-draggable
# npm i dialog-draggable

make <dialog> draggable

import { makeDialogDraggable } from 'dialog-draggable';

makeDialogDraggable();

Trigger dragging by inner dom

add data-dialog-draggable attribute to inner tags, so they can trigger the outer <dialog> dragging. Notice <button> and <a> tags are excluded.

<!-- Example -->
<dialog id="dialog">
  <nav data-dialog-draggable>
    Dialog title
    <!-- buttons won't trigger dragging -->
    <button type="button">X</button>
  </nav>
  <!-- dialog contents -->
</dialog>

Develop

pnpm install

local dev preview

pnpm dev

test

pnpm test

Supported by JetBrains open source program.

Package Sidebar

Install

npm i dialog-draggable

Weekly Downloads

49

Version

0.1.5

License

MIT

Unpacked Size

15 kB

Total Files

9

Last publish

Collaborators

  • naeemo