Coder Social home page Coder Social logo

float-drag's Introduction

FloatDrag

移动设备上任意元素在屏幕内浮动与拖动

原生 JavaScript 编写,适用于触屏设备。

使用示意

① 引入 JS 文件

<script src="float-drag.js"></script>

② 绑定

new FloatDrag(document.getElementById('ball'));

参数

new FloatDarg(ele, option);

其中:

  • ele表示需要拖动的元素;
  • option为可选参数,包括:
    • edge,对象,表示元素与边缘的距离值,默认为{ left: 0, right: 0, top: 0, bottom: 0 },未填的方向默认为0
    • isRemember,布尔值,表示是否记录元素位置(使用localstorage,以元素 ID 作为索引),默认为true

在线预览

点击查看在线demo

float-drag's People

Contributors

gisonyeung avatar

Watchers

James Cloos avatar

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.