• 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

  • 相关阅读:
    分享15个Linux 实用技巧,提高工作效率
    隐藏搜索框:CSS 动画正反向序列
    js检测开发者工具是否打开,防止别人恶意调试我们的代码
    Js实现元素右滑回弹效果(基于Uniapp)
    css ::marker伪元素,修改li的项目符号颜色,字号字体
    Jump Game II
    Google 面经 09/26
    Word Search
    Remove Duplicates from Sorted List
    Remove Duplicates from Sorted List II
  • 原文地址:https://www.cnblogs.com/iwzyuan/p/8920441.html
Copyright © 2020-2023  润新知