Giter Club home page Giter Club logo

drag-modal's Introduction

模态框拖拽事件快速实现

Scripts

npm i
// 打包ES Module包
npm run build
// 打包UMD包
npm run build-umd
// 打开demo.html快速体验模态框拖动操作

Params

dragModal(element, dragAttrs, options)

如果是 UMD 使用 dragModal.default(element, dragAttrs, options)

element

模态框 Element 对象

dragAttrs

标识各个拖拽部件组件属性

属性名 说明 默认值
move 拖拽移动窗口部件 drag-move
resize.left 修改窗口大小左侧部件 drag-resize-left
resize.right 修改窗口大小右侧部件 drag-resize-right
resize.top 修改窗口大小顶部部件 drag-resize-top
resize.bottom 修改窗口大小底部部件 drag-resize-bottom

options

其他配置

属性名 说明 默认值
minWidth 窗口最小宽度 250
minHeight 窗口最小高度 250

Demo

dragModal(
  document.getElementById("modal"),
  {
    move: "drag-move",
    resize: {
      left: "drag-resize-left",
      right: "drag-resize-right",
      top: "drag-resize-top",
      bottom: "drag-resize-bottom",
    },
    {
      minWidth: 250,
      minHeight: 250,
    }
  }
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.