Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script defer src="https://use.fontawesome.com/releases/v5.7.2/js/all.js" integrity="sha384-0pzryjIRos8mFBWMzSSZApWtPl/5++eIfzYmTgBBmXYdhvxPc+XcFEk+zJwDgWbP" crossorigin="anonymous"></script>

<div class="custom-file-picker"> 
    <div class="picture-container form-group">
        <h4 class="info_text">Upload Proof of Physical Address</h4>
        <div class="picture">
            <span class="icon"><i class="fas fa-file-upload"></i></span>
            <input type="file" class="wizard-file" multiple id="a8755cf0-f4d1-6376-ee21-a6defd1e7c08">
            <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 37 37" xml:space="preserve">
                <path class="circ path" style="fill:none;stroke:#77d27b;stroke-width:3;stroke-linejoin:round;stroke-miterlimit:10;" d="M30.5,6.5L30.5,6.5c6.6,6.6,6.6,17.4,0,24l0,0c-6.6,6.6-17.4,6.6-24,0l0,0c-6.6-6.6-6.6-17.4,0-24l0,0C13.1-0.2,23.9-0.2,30.5,6.5z"></path>
                <polyline class="tick path" style="fill:none;stroke:#77d27b;stroke-width:3;stroke-linejoin:round;stroke-miterlimit:10;" points="11.6,20 15.9,24.2 26.4,13.8 "></polyline>
            </svg>
        </div>     
    </div>
    <div class="popover-container text-center">
        <p data-toggle="popover" data-id="a8755cf0-f4d1-6376-ee21-a6defd1e7c08" class="btn-popover" data-original-title="" title="">
            <span class="file-total-viewer">0</span> Files Selected <input type="button" value="view" href="javascript:void(0)" class="btn btn-success btn-xs btn-file-view">
        </p>
    </div>
</div>
              
            
!

CSS

              
                .picture-container{
    position: relative;
    cursor: pointer;
    text-align: center;
    margin-bottom: 15px;
}

.picture{
    width: 100px;
    height: 100px;
    background-color: #fff;
    color: #FFFFFF;
    margin: 5px auto;
    overflow: hidden;
    -webkit-transition: all 0.2s;
    -moz-transition: all 0.2s;
    -o-transition: all 0.2s;
    transition: all 0.2s;
}

.picture > .icon{
    width: 100%;
    height: 100%;
    display: inline-block;
    color: #37474F;
    border: 4px solid #CCCCCC;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    -o-border-radius: 50%;
    border-radius: 50%;
    -webkit-transition: all 0.2s;
    -moz-transition: all 0.2s;
    -o-transition: all 0.2s;
    transition: all 0.2s;
}

.picture:hover .icon{
    border-color: greenyellow;
}

.picture > .icon > svg{
    height: 1.4em;
    font-size: 4em;
}

.picture > svg{
    width: 100%;
    height: 100%;
}

.picture input[type="file"]{
    cursor: pointer;
    display: block;
    height: 100%;
    left: 0;
    opacity: 0 !important;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 100;
    right: 0;
    bottom: 0;
}

/*svg tick animation*/
.circ {
    opacity: 0;
    display: none;
    stroke-dasharray: 130;
    stroke-dashoffset: 130;
    -webkit-transition: all .75s;
    -moz-transition: all .75s;
    -ms-transition: all .75s;
    -o-transition: all .75s;
    transition: all .75s;
}
.tick{
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    -webkit-transition: stroke-dashoffset .4s 0.5s ease-out;
    -moz-transition: stroke-dashoffset .4s 0.5s ease-out;
    -ms-transition: stroke-dashoffset .4s 0.5s ease-out;
    -o-transition: stroke-dashoffset .4s 0.5s ease-out;
    transition: stroke-dashoffset .4s 0.5s ease-out;
}
.drawn > svg .path{
    display: block;
    opacity: 1;
    stroke-dashoffset: 0;
}

.drawn{
    border-color: #fff;
}

[data-toggle="popover"]{
    cursor: pointer;
}

span.popover-content-remove {
    padding-left: 10px;
    color: red;
    cursor: pointer;
    float: right;
}

.pb10{
    padding-bottom: 10px;
}

.popover-header{
    text-align: center;
}

.popover{
    min-width: 200px;
}
              
            
!

JS

              
                //Global object to store the files
let fileStorage = {};

$(document).ready(function(){
   //Handle the file change
   $("input[type='file']").change(function(e){
      //Get the id
      let id = e.target.id;

      //Get the files
      let files = e.target.files;

      //Store the file
      storeFile(id, files);

      //Show the complete icon
      $(this).siblings('.icon').hide();
      $(this).parent().removeClass('drawn');
      setTimeout(() => {
         $(this).parent().addClass('drawn');
      }, 50); 
   });
  
    //Store the file for particular filepicker
    let storeFile = (id, files) => {
      fileStorage[id] = files;

      //Update the file count
      $(`[data-id="${id}"] > .file-total-viewer`).text(files.length);
    }
    
    //Show file list
    $('[data-toggle="popover"]').popover({
        html: true,
        title: "Files",
        placement:"bottom",
        content: function () {
          //Get the id of the file picker
          let id = $(this).attr('data-id');

          //Get all the files of this filepicker
          let items = fileStorage[id];

          //Preview the file 
          let template = '<div class="row">';
          if(items && items.length){
            for(let val of items){
               template += "<div class='col-12 pb10'><span class='popover-content-file-name'>" + val.name + "</span><span class='popover-content-remove' data-target='" + id + "' data-name='" + val.name + "' data-type='upload'><i class='fas fa-trash'></i></span></div>"
             }
           }else{
             template += "<div class='col-12 pb10'><span class='popover-content'>No file</span></div>";
           }

           template += '</div>';
           return template;
         }
    });
  
   //Prevent multiple popover
   $('body').on('click', function (e) {
       $('[data-toggle="popover"],[data-original-title]').each(function () {
           //the 'is' for buttons that trigger popups
           //the 'has' for icons within a button that triggers a popup
           if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
              (($(this).popover('hide').data('bs.popover') || {}).inState || {}).click = false;  // fix for BS 3.3.6
           }
      });
  });
  
  //Delete files
  $(document).on('click', '.popover-content-remove', function (e) {
      //Get the id whose file to delete
      let id = $(this).attr('data-target');

      //Get the name of the file to delete
      let name = $(this).attr('data-name');

      //Confirm delete
      let isDelete = confirm("Do you really want to delete this file?");  

      //If confirmed
      if (isDelete) {
         //Remove the requested file
         let files = Object.values(fileStorage[id]);
         let newArr = files.filter((e) => { return e.name !== name; });

         //Update the list
         storeFile(id, newArr);

          //If there is no file then show No file
          if(newArr.length === 0){
                $(this).parent().parent().append("<div class='col-12 pb10'><span class='popover-content'>No file</span></div>");
           }

           //Remove the current file
           $(this).parent().remove();
        }
  });
});
              
            
!
999px

Console