zoukankan      html  css  js  c++  java
  • jQ复制按钮的插件zclip

    zclip官网:http://www.steamdev.com/zclip/

    swf文件国内下载:ZeroClipboard.swf

    jQuery-zclip是一个复制内容到剪贴板的jQuery插件,使用它我们不用考虑不同浏览器和浏览器版本之间的兼容问题。jQuery-zclip插件需要Flash的支持,使用时记得安装Adobe Flash Player。

    使用方法:

    1、先引入JQ库与插件文件:

    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.zclip.js"></script>

    2、然后用使用官方提供的调用方法:

    $(document).ready(function(){
      $('a#copy-description').zclip({
      path:'js/ZeroClipboard.swf',
      copy:$('p#description').text()
    });
    // The link with ID "copy-description" will copy
    // the text of the paragraph with ID "description"

    $('a#copy-dynamic').zclip({   path:'js/ZeroClipboard.swf',   copy:function(){return $('input#dynamic').val();} }); // The link with ID "copy-dynamic" will copy the current value // of a dynamically changing input with the ID "dynamic" });

     这是我项目里面用到的写法:

     $('.aff_info ul li input[type="button"]').zclip({
         path:'/templates/default/images/copy-btn/ZeroClipboard.swf',
         copy:function(){
                return $(this).siblings('input[type="text"]').val(); },
         beforeCopy:function(){
                console.log("copy success"); },
         afterCopy:function(){
                $(this).css('background','#999999');
                $(this).parent().siblings().find('input[type="button"]').css('background','#444444'); }
            });        
    
  • 相关阅读:
    java 代码规范 sun 公司
    软引用、弱引用、虚引用
    socket
    httpURLConnection、URL、httpClient、httpPost、httpGet
    android service aidl 理解
    Python2.7-codecs
    Python2.7-textwrap
    Python2.7-StringIO和cStringIO
    Python2.7-difflib
    Python2.7-struct模块
  • 原文地址:https://www.cnblogs.com/3box/p/4580324.html
Copyright © 2011-2022 走看看