zoukankan      html  css  js  c++  java
  • Javascript知识汇总------手写多文件上传组件

    手写基于JQ的组件开发,适合用于多文件上传(图片、pdf、压缩包上传等)

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
            .picUpCont label {
                width: 100%!important;
            }
            .fileBox_loading.hide {
                display: none;
            }
            .picUpWrap {
                width: 100%;
                overflow: hidden;
                text-align: center;
                /* padding-right: 15px; */
                padding-bottom: 5px;
            }
            .fileBox {
                width: 100px;
                height: 100px;
                margin-bottom: 30px;
                float: left;
                position: relative;
                margin: 0 5px 40px;
            }
            .filesInput {
                display: none;
            }
            .uploadBtn .fileBox_addBtn {
                width: 100%;
                height: 100%;
                font-size: 40px;
                line-height: 100px;
                text-align: center;
                color: #666;
                border: 1px dashed #ccc;
                box-sizing: border-box;
            }
            .uploadBtn .fileBox_showImg{
                position: absolute;
                width: 100%;
                top: 0;
                bottom: 0;
                left: 0;
                margin: auto;
            }
            .fileBox .fileBox_addBtn {
                width: 100%;
                height: 100%;
                font-size: 40px;
                line-height: 100px;
                text-align: center;
                color: #666;
                border: 1px dashed #ccc;
                box-sizing: border-box;
            }
            .fileBox .fileBox_showImg{
                position: absolute;
                width: 100%;
                top: 0;
                bottom: 0;
                left: 0;
                margin: auto;
            }
            .fileBox input {
                display: none;
            }
            .uploadBtn .fileBox_discription{
                position: absolute;
                width: 100%;
                bottom: -25px;
                text-align: center;
                color: #999;
                font-size: 14px;
                text-decoration: underline;
            }
            .uploadBtn .fileBox_discription1{
                position: absolute;
                width: 100%;
                bottom: -25px;
                text-align: center;
                color: #999;
                font-size: 14px;
            }
            .fileBox .fileBox_discription{
                position: absolute;
                width: 100%;
                bottom: -25px;
                text-align: center;
                color: #999;
                font-size: 14px;
                text-decoration: underline;
            }
            .fileBox .fileBox_discription1{
                position: absolute;
                width: 100%;
                bottom: -25px;
                text-align: center;
                color: #999;
                font-size: 14px;
            }
            .fileBox_loading {
                position: absolute;
                width: 100%;
                background: url('/public/home/imgs/loading.gif') center center no-repeat;
                background-size: 50px 50px;
                height: 100%;
            }
            .uploadCont {
                overflow: hidden;
                padding: 5px 15px;
            }
            .showPic {
                position: fixed;
                width: 100%;
                height: 100%;
                top: 0;
                left: 0;
                z-index: 999;
                display: none;
                overflow: auto;
            }
            .showPic .showPic_mask {
                background: rgba(0,0,0,.5);
                position: absolute;
                width: 100%;
                height: 100%;
                left: 0;
                top: 0;
                z-index: 1;
                display: block;
            }
            .showPic .showPic_img {
                position: absolute;
                width: 90%;
                height: auto;
                top: 50%;
                z-index: 2;
                transition: all .5s;
                opacity: 0;
                left: 0;
                right: 0;
                margin: auto;
            }
            .showPic .showPic_loading {
                width: 50px;
                height: 50px;
                position: absolute;
                top: 0;
                bottom: 0;
                left: 0;
                right: 0;
                margin: auto;
            }
            .showPic_desTxt {
                width: 100%;
                position: absolute;
                bottom: 40px;
                color: #fff;
                z-index: 9;
                text-align: center;
                font-size: 16px;
            }
            .uploadBtn {
                width: 30%;
                height: 100px;
                margin-bottom: 30px;
                float: left;
                position: relative;
                margin: 0 5px 40px;
            }
        </style>
    </head>
    <body>
        <div id="no_limit_uploadCont">
            <div class="fileBox up-section">
                    <div class="fileBox_loading" style="display:none;"></div>
                    <img class="fileBox_showImg" src="loading.gif" original="loading.gif">
                    <div class="fileBox_discription" style="display:block;">点击删除</div>
            </div>
            
            <div class="fileBox" id="uploadBtn">
                    <div class="fileBox_addBtn">+</div>
                    <!-- <div class="fileBox_discription" style="display:block;">点击上传</div> -->
                    <input type="file" class="filesInput" multiple  />
            </div>
        </div>
        <script src="jquery.js"></script>
        <script src="jquery.fileUpload_nolimit.js"></script>
        <script>
            var nolimit_upload = new No_limitUpload('no_limit_uploadCont');
            nolimit_upload.init({
            });
        </script>
    </body>
    </html>

    插件下载地址:https://files.cnblogs.com/files/iwzyuan/jquery.fileUpload_nolimit.js

  • 相关阅读:
    python 合并 Excel 单元格
    python 设置 Excel 表格的行高和列宽
    Python 用 openpyxl 模块统计 Excel 表格中的数据,以字典形式写入 py 文件
    python 打印字母阶梯和金字塔
    python 用 openpyxl 读取 Excel 表格中指定的行或列
    Python 的 filter() 函数
    Python 的 map() 函数
    python 之 range() 函数
    python 的 reduce() 函数
    python 之 lambda 函数
  • 原文地址:https://www.cnblogs.com/iwzyuan/p/8920441.html
Copyright © 2011-2022 走看看