Giter Site home page Giter Site logo

action's Introduction

English version is here.

Action

轻松随意绑定点击事件!

用法简介

第一步

先定义一些动作:

action.add({
    'my-action': function () {
        //do something...
    },
    ...
})

第二步

在页面里创建一些元素,比如这样:

<button data-action="my-action">btn</button>

或这样:

<a href="#" data-action="my-action">link</a>

或这样:

<a href="#my-action" data-action>link</a>

第三步

其实已经不需要第三步了。

点击这些元素就可以触发你定义的那个动作了!

兼容性

依赖以下类库:

  • jQuery(或兼容类库,比如 Zepto)

支持以下浏览器:

  • IE 6+(需要 jQuery 1.x)
  • Chrome/Firefox/Safari 等现代浏览器

安装

$ bower install action
  1. 通过 Bower 安装。
  2. 在页面中加载 src/action.js 脚本文件。

API 文档

你需要了解以下 API,详细文档参见 Wiki

  • HTML API
  • JavaScript API
    • action.add()
    • action.trigger()

谁在用?

移动 UI 框架 CMUI 采用 Action 作为全局的基础设施,因此所有 CMUI 用户都在使用 Action:


License

MIT License

action's People

Contributors

cssmagic avatar zpbx avatar

Watchers

 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.