Skip to content

This is a drag floating ball component developed based on typescript, which can be directly introduced into your project

License

Notifications You must be signed in to change notification settings

QC2168/better-draggable-ball

Repository files navigation

better-draggable-ball

这是一款使用纯TYPESCRIPT开发的可拖拽悬浮球,这意味着它不需要安装其他依赖即可直接导入到你的开发项目当中使用

最简单的使用方法

第一步,您需要在您的项目中安装它,执行以下命令

npm install better-draggable-ball --save

在您的项目中导入BetterGraggbleBall

import BDrag from 'better-draggable-ball';

创建一个div,并给他设置一个ID值和样式

<div class="root">
    <div class="BDrag"></div>
</div>
.drag{
    width: 50px;
    height: 50px;
    background-color: rgb(238, 238, 238);
    border-radius: 50%;
    border: 5px solid rgb(170, 170, 170);
}

BetterGraggbleBall提供了一个类,实例化的第一个参数是一个原生DOM元素

const BDragDom = document.getElementById('BDrag')
const BDrag = new BDrag(BDragDom)

About

This is a drag floating ball component developed based on typescript, which can be directly introduced into your project

Resources

License

Stars

Watchers

Forks

Packages

No packages published