Giter Club home page Giter Club logo

jclip's Introduction

jClip.js - 兼容多浏览器的文本复制插件

jQuery插件,兼容IE、Chrome、Firefox等。

封装自zeroclipboard.js,感谢原作者。

使用方法

1. 部署jClip

  • 所需文件目录结构如下 --ZeroClipboard.swf --jquery.jclip.js

2. 引入jquery.jclip.js

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.8.3.min.js"><\/script>')</script>
<script src="js/jquery.jclip.js"></script>

3. HTML代码

<p class="text">Hello world! </p>
<a href="###" class="btn_copy">点击复制</a>
<br/><br/>
<a href="###" class="btn_ajax_text">复制ajax返回数据</a>
<br/><br/>
<a href="###" class="btn_func_text">复制function返回数据</a>

4. Javascript调用代码

<script type="text/javascript" >
$(function(){
    //复制静态文本
    $(".btn_copy").jclip({
        path:'js/ZeroClipboard.swf',
        copy:$(".text").text()
    });

    //复制ajax返回的数据
    $.get("text.php", function(data){
        $(".btn_ajax_text").jclip({
            path:'js/ZeroClipboard.swf',
            copy:data
        });
    });

    //复制函数返回的数据
    function retText(){
        return "return by function";
    }
    $(".btn_func_text").jclip({
        path:'js/ZeroClipboard.swf',
        copy:retText
    });
});
</script>

5. 修改复制成功提示语

在jquery.jclip.js文件中Line 62.

相似项目

zclip.js

jclip's People

Contributors

jiji262 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

jinligen

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.