Git Product home page Git Product logo

click-modify's Introduction

click-modify


click-modify是一个基于seajs的插件.当页面的文本元素被注册了click-modify事件后,点击该元素时自动切换为可编辑状态,离开编辑时,提供回调接口来处理后续的工作.

Required Library: jQuery


Getting Start

Install tornado:

pip install tornado

Start server:

python server.py

Config

click-modify支持配置如下参数:

  • trigger: 被绑定的元素,同jQuery selector

  • style: 生成的input或者textarea的样式

  • type: 选择是input还是textarea来装载文本 默认为input

  • finish: 离开编辑模式的处理回调 提供两个参数$trigger$box, 其中, $trigger是被绑定的元素,$box是编辑状态时候的容器.

Usage

  • basic usage:

    seajs.use('../src/click-modify', function(ClickModify){
        var c = new ClickModify('trigger', function($trigger, $box){
                //process data
            });
    }
  • advanced:

    seajs.use('../src/click-modify', function(ClickModify){
        var options = {
                trigger: '.click-modify',
                type: 'input',
                style: {'color':'red'}, //will be passed to $('trigger').css(style);
                success: function($trigger, $box){
                    //process data;
                    }
            };
        var click_modify = new ClickModify(options, function($trigger, $box){
            console.log($trigger);
            console.log($box);
        }));
    });

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.