<div id="filePicker" class="webuploader-container">
<div class="webuploader-pick">选择图片</div>
<div id="rt_??" style="position: absolute; top: 0px; left: 0px; width: 78px; height: 34px; overflow: hidden; bottom: auto; right: auto;">
<input type="file" name="file" class="webuploader-element-invisible" multiple="multiple" accept="image/*">
<label style="opacity: 0; width: 100%; height: 100%; display: block; cursor: pointer; background: rgb(255, 255, 255);"></label>
</div></div>
查看文档发现可以在UI渲染完毕 刷新UI 原因是当前父节点有隐藏了 导致宽高不显示
image.png
image.png
uploader.refresh();
$('.webuploader-pick').next().css({"width":"960px","height":"300px"});
function closeUploader() {
// 移除所有缩略图并将上传文件移出上传序列
for (var i = 0; i < uploader.getFiles().length; i++) {
// 将图片从上传序列移除
uploader.removeFile(uploader.getFiles()[i]);
//uploader.removeFile(uploader.getFiles()[i], true);
//delete uploader.getFiles()[i];
// 将图片从缩略图容器移除
var $li = $('#' + uploader.getFiles()[i].id);
$li.off().remove();
}
setState('pedding');
// 重置文件总个数和总大小
fileCount = 0;
fileSize = 0;
// 重置uploader,目前只重置了文件队列
uploader.reset();
// 更新状态等,重新计算文件总个数和总大小
updateStatus();
}
uploader.onUploadProgress = function( file, percentage ) {
var $li = $('#'+file.id),
$percent = $li.find('.progress span');
$percent.css( 'width', percentage * 100 + '%' );
percentages[ file.id ][ 1 ] = percentage;
updateTotalProgress();
};
网友评论