Giter Club home page Giter Club logo

touch-ripple's Introduction

touch-ripple

触摸涟漪反馈效果, 支持 颜色自定义,涟漪直径自定义和涟漪速度自定义, 不影响原有事件, 兼容移动端

查看DEMO

web多数的体验效果不佳是因为很多交互没有及时给出反馈, 特别是处理异步逻辑的时候用户需要等待, 如果按钮点击后没及时给出反馈就会让页面有卡顿的感觉,这个小插件就是为了解决触发某些动作之前的按钮反馈效果

安装方法

  • 方式一
npm install touch-ripple --save
  • 方式二
下载项目中的dist/touch-ripple.min.js, 然后用script标签插入到你的项目中, 如下
这种方式可以通过window.TouchRipple访问
<script type="text/javascript" src="dist/touch-ripple.min.js"></script>

使用方法

import TouchRipple from 'touch-ripple'

// 最简单的使用方法
new TouchRipple('.btn')

// 如果需要定义涟漪颜色可以这样初始化
new TouchRipple('.btn', 'rgba(0,0,0,0.2)')

// 如果还有其它设置 请这样写
new TouchRipple('.btn', {
  time: 500, // 涟漪散发时间
  color: 'rgba(0,0,0,0.2)', // 涟漪颜色
  size: 200 // 涟漪直径
}

参数说明

AnimateText接收两个参数, 例如: new AnimateText(element, options)

参数 类型 是否必填 描述
element String or Object 可以是选择器或者dom节点对象(请保证这个节点内只有文本而没有其它节点)
options String or Object 如果第二个参数是字符串, 则当作动画时间处理, 如果有其他参数, 以对象格式传递, 具体每个属性的描述请看下方的 options说明

options说明

第二个参数options详细说明

参数 类型 默认值 是否必填 描述
color String rgba('0,0,0,0.2') 涟漪颜色, 可以传入css能识别的颜色字符串
size Number element宽和高的较大值 涟漪直径
time Number 500 涟漪扩散时间

touch-ripple's People

Contributors

qgh810 avatar

Stargazers

Hwaphon avatar

Watchers

James Cloos avatar 一兵 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.