jQuery拖拽批量上传文件插件

2025-11-05 05:47:53

1、新建html文档。

jQuery拖拽批量上传文件插件

2、书写hmtl代码。

<section role="main" class="l-main" style="margin-top:50px;margin-bottom:50px;">

<header class="site-header">

<h1 class="site-title l-site-title" style="font-size:1.2em;">jQuery拖拽批量上传文件插件</h1>

</header>

<div class="uploader__box js-uploader__box l-center-box">

<form action="#" method="POST">

<div class="uploader__contents">

<label class="button button--secondary" for="fileinput">请选择文件</label>

<input id="fileinput" class="uploader__file-input" type="file" multiple value="Select Files">

</div>

<input class="button button--big-bottom" type="submit" value="Upload Selected Files">

</form>

</div>

</section>

jQuery拖拽批量上传文件插件

3、书写css代码。

body, html { font-size: 100%; padding: 0; margin: 0; }

*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }

.clearfix:before, .clearfix:after { content: " "; display: table; }

.clearfix:after { clear: both; }

body { font-weight: 500; font-size: 1.05em; font-family: "Microsoft YaHei", "Segoe UI", "Lucida Grande", Helvetica, Arial, sans-serif; }

jQuery拖拽批量上传文件插件

4、书写并添加js代码。

<script src="js/jquery-1.11.0.min.js"></script>

<script src="dist/jquery.imageuploader.js"></script>

<script>

(function(){

var options = {};

$('.js-uploader__box').uploader({

'selectButtonCopy':'请选择或拖拽文件',

'instructionsCopy':'你可以选择或拖拽多个文件',

'submitButtonCopy':'上传选择的文件',

'furtherInstructionsCopy':'你可以选择或拖拽更多的文件',

'secondarySelectButtonCopy':'选择更多的文件',

});

}());

</script>

jQuery拖拽批量上传文件插件

5、代码整体结构。

jQuery拖拽批量上传文件插件

6、查看效果。

jQuery拖拽批量上传文件插件

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
相关推荐
  • 阅读量:104
  • 阅读量:171
  • 阅读量:70
  • 阅读量:75
  • 阅读量:39
  • 猜你喜欢