jQuery.filer 文档配置说明

Options & Features

Fully documentation of plugin options and features.

Options:

  • limit Maximum Limit of files. {null, Number}
  • maxSize Maximum Size of files. {null, Number(in MB’s)}
  • extensions Whitelist for file extension. {null, Array}
  • changeInput Change input. {Boolean, String(HTML element), Object(DOM Element)}
  • showThumbs Show input files as thumbnails. {Boolean}
  • appendTo Append thumbnails to element. {null, String(Dom Element)}
  • theme jQuery.filer theme. {null, String}
  • templates
    • box Thumbnails box element {null, String}
    • item Thumbnails file item element {String(use Filer Variables), Function}
    • itemAppend Thumbnails appended file item element {String(use Filer Variables), Function}
    • progressBar Thumbnails file item upload progress bar element {String}
    • itemAppendToEnd Append file item to the end of list {Boolean}
    • removeConfirmation Remove file confirmation {Boolean}
    • selectors
      • list List selector {String}
      • item Item selector {String}
      • progressBar Progress bar selector {String}
      • remove Remove button selector {String}
  • uploadFile
    • url URL to which the request is sent {String}
    • data Data to be sent to the server {Object}
    • type The type of request {String}
    • enctype Request enctype {String}
    • beforeSend A pre-request callback function {Function}
    • success A function to be called if the request succeeds {Function}
    • error A function to be called if the request fails {Function}
    • statusCode An object of numeric HTTP codes {Object}
    • onProgress A function called while uploading file with progress percentage {Function}
    • onComplete A function called when all files were uploaded {Function}
  • dragDrop
    • dragEnter A function that is fired when a dragged element enters the input. {Function}
    • dragLeave A function that is fired when a dragged element leaves the input. {Function}
    • drop A function that is fired when a dragged element is dropped on a valid drop target.
  • addMore Multiple file selection without instant uploading {Boolean}
  • clipBoardPaste Printscreen paste and upload {Boolean}
  • excludeName Removed files input name {null, String} Default: jfiler-items-exclude-(input file name)-(input index)
  • beforeShow A function that is fired before showing thunbnails {Function}
  • onSelect A function that is fired after selecting files {Function}
  • afterShow A function that is fired after appending all thumbnails items {Function}
  • onRemove A function that is fired after deleting a file {Function}
  • onEmpty A function that is fired when no files are selected {Function}
  • captions
    • button New Input button text {String}
    • feedback New Input field text {String}
    • feedback2 New Input after choosing files text {String}
    • drop New Input on drag text {String}
    • removeConfirmation Remove file confirmation text {String}
    • errors
  • files [
        {
            name: "appended_file.jpg",
            size: 5453,
            type: "image/jpg",
            file: "/path/to/file.jpg"
        },
        {
            name: "appended_file_2.jpg",
            size: 9453,
            type: "image/jpg",
            file: "path/to/file2.jpg"
        }
    ]
  • beforeRender:在渲染jQuery.filer input之前触发。
  • afterRender:在渲染jQuery.filer input之后触发。
  • beforeShow:在显示缩略图之前触发。
  • afterShow:在显示缩略图之后触发。
  • beforeSelect:在选择一个文件之后,并在将该文件添加到input之前触发。该函数返回一个布尔值。
  • onSelect:在选择一个文件之后触发。
  • onRemove:在移除一个文件之后触发。
  • onEmpty:在没有文件被选择的时候触发。
  • options:在对象中定义自己的参数,定义之后可以在任何地方使用。
  • captions:指定自己的标题。

Triggers:

  • $(‘#input_file’).trigger(“filer.append”, {files:[]})
  • $(‘#input_file’).trigger(“filer.remove”, {id:0})
  • $(‘#input_file’).trigger(“filer.reset”)
  • $(‘#input_file’).trigger(“filer.getList”, {files:[]})
  • $(‘#input_file’).trigger(“filer.retry”, here_is_file_id)

Attributes:

  • data-jfiler-name | name of input (is used while applying plugin to a non file input)
  • data-jfiler-limit | files limit
  • data-jfiler-maxSize | files maximum size
  • data-jfiler-extensions | separeted with comma
  • data-jfiler-changeInput | {Boolean, String}
  • data-jfiler-showThumbs | show thumbnails
  • data-jfiler-appendTo | append thumbnails to selector
  • data-jfiler-theme | custom filer theme
  • data-jfiler-excludeName | exclude files input name
  • data-jfiler-files | append files, ex: “{“files”:[{“name”:”appended_file.jpg”,”size”:5453,”type”:”image/jpg”,file:”/path/to/file/appended_file.jpg”}]}”

 

更多查看 http://www.jq22.com/jquery-info11363

分享到:

发表评论

电子邮件地址不会被公开。 必填项已用*标注