• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

samthor/rippleJS: vanilla Material Design ripples

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

samthor/rippleJS

开源软件地址(OpenSource Url):

https://github.com/samthor/rippleJS

开源编程语言(OpenSource Language):

JavaScript 54.5%

开源软件介绍(OpenSource Introduction):

rippleJS

Adds Material Design-style feedback ripples to your existing HTML without any dependencies. Show me the demos!

Usage

Include the rippleJS script (or use a local copy). Then, add elements with the rippleJS class within a parent element that has layout (aka, position: relative or position: absolute).

<button class="yourButton">
  Click Me
  <div class="rippleJS"></div>
</button>

<script async src="https://cdn.jsdelivr.net/npm/vanilla-ripplejs@1.0.6"
    integrity="sha384-OlarGErerEgz/M7123pQTTek4pUIiR6t0BK09bTmWDi2cZYbv3VHrriaXDnA0Oup"
    crossorigin="anonymous"></script>
<!-- or if using ES6 modules -->
<script type="module">
  import 'https://cdn.jsdelivr.net/npm/vanilla-ripplejs@1.0.6';
</script>

rippleJS adds handlers on document.body, so you don't need to register any new elements as you add them to the DOM. It supports touch and mouse events (even at the same time), and includes its own CSS.

Ripple Fill

By adding the fill class to a rippleJS element, the ripple will fill to rounded corners, good for form elements with fixed size. For example:

<div class="optHolder">
  <input type="checkbox" />
  <div class="rippleJS fill"></div>
</div>

Ripple Color

The default color is a transparent version of the current color (aka, the currentColor keyword). To change this default, add the following style rule:

.rippleJS .ripple {
  background: red;
}

You could also change it just for some elements:

.yourClassName .rippleJS .ripple {
  background: blue;
}

Or change the level of opacity:

.moreOpaque .rippleJS .ripple {
  opacity: 0.65;
}

Supports

Chrome, Safari, Firefox (all as of Dec 2014). Requires classList, so probably only supports IE10+.

Install

Instead of using rippleJS directly, you can fetch it using your favourite package manager:

$ bower install vanilla-ripplejs
$ npm install vanilla-ripplejs

You can either use ripple.min.js for a precompiled version to just drop into your site, or you could use lib.js included as a ES module. If you use lib.js, you'll need to include the CSS too—check out ripple.js for how this is done for the minified version, or you could just add the CSS to your regular styles.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap