javascript - 对话框不适合多个选择文件的屏幕

标签 javascript jquery css ember.js ember-1

我有一个包含文件夹上传文件的对话框,当我选择多个文件(大约超过 25 个文件)进行上传时,对话框底部的长度增加了,滚动条是不显示向下滚动以完整查看文件。

截图如下:

enter image description here

这里我添加了 36 个文件,当我想查看上传的文件列表时,它没有完全显示,滚动条也显示向下滚动以查看更多内容。

对话框的 HTML 在这里:

<div class="upload-files-dialog" tabindex="0" role="dialog" style="position: absolute; height: auto; top: 0px; left: 277px; display: block; width: 270px; right: auto; bottom: auto;" aria-describedby="ui-id-3" aria-labelledby="ui-id-4">

我试过的对应的css样式为:

div.upload-files-dialog {
 {
    position: absolute;
    height: auto;
    top: 0px;
    left: 226px;
    display: block;
    width: 270px;
    right: auto;
    bottom: auto;
 }

我已经提到高度是自动的,然后它也不会随屏幕调整。

对话框对应的hbr文件在这里:

{{#if view.showFileList}}
    {{file-list view.fileList}}
{{/if}}

对应ember代码的fileList在这里:

        menuContext: null,

        formData: function () {
            if (!this.get('menuContext.formData')) {
                this.set('menuContext.formData', Ember.Object.create({ data: Ember.Object.create({ }), files: [] }));
            }
            return this.get('menuContext.formData.data');
        }.property('menuContext'),

        uploadHandle: null,

        showFileList: function () {
            return (this.get('uploadHandle.files.length') || this.get('menuContext.formData.data.file.length')) > 1;
       }.property('uploadHandle.files.length', 'menuContext.formData.data.file'),

        fileList: function () {
            return this.get('uploadHandle.files') || [].slice.call(this.get('menuContext.formData.data.file'));
        }.property('uploadHandle.files', 'menuContext.formData.data.file')

当我按下控制台 (F12) 时,滚动条开始出现,对话框也根据页面进行更改。但是当我上传文件时间本身时,我需要。我不知道问题出在哪里,无论是 css 还是 ember 或 jquery。任何人都可以就此向我提出建议。

最佳答案

您需要为 div.upload-files-dialog 指定一个 max-height 才能发生溢出。

例子:

div.upload-files-dialog {
    position: absolute;
    height: auto;
    max-height: 370px;
    top: 0px;
    left: 226px;
    display: block;
    width: 270px;
    right: auto;
    bottom: auto;
 }

关于javascript - 对话框不适合多个选择文件的屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52380668/

相关文章:

javascript - TinyMce 设置最大宽度

jquery - 时间选择器的问题

php - Ajax jQuery 数组中的 POST 未定义索引

提示内的 Javascript 日期选择器

javascript - 使用 jQuery 实现效果

html - :after in Bootstrap 4 not positioning same as Boostrap 3

html - 在dreamweaver cs6 mac上安装scss和less

javascript - jQuery 选项卡 - 选择创建内容面板的位置

javascript - 显示搜索查询的点击次数 - vue - javascript

javascript - 如何遍历 JSON 数组?