danielm/uploader

File List does not look accurate with lots of files being uploaded

Abolfazl opened this issue · 5 comments

When I am adding a lot of files, the spacing starts to look very off.

To see an example of this, go to the Basic Demo and then in console run ui_multi_add_file('xxx','xxx') around 5+ times just to add these examples. You will see the CSS starts looking a little borked.

Here is a screenshot when I try to add 10 files.

image

I tested on Chrome, Firefox, and Edge and this only seems to be a problem on Chrome. Can anyone else verify?

I saw the same thing. Changed the .css for the file list to remove flex classes, IIRC.

I saw the same thing. Changed the .css for the file list to remove flex classes, IIRC.

I do not see any flex classes in the jquery.dm-uploader.min.css or styles.css files

Here are your culprits. -webkit-box-flex and flex. Turn 'em off and you're good to go
It's been awhile, but I believe I fixed this using the following .css to override the @media css in grids.css. Make sure it is loaded AFTER your bootstrap css.


[class*="col-"] {
	padding-top: 1rem;
	padding-bottom: 1rem;
}   
hr {
	margin-top: 2rem;
	margin-bottom: 2rem;
}
#files {
    overflow-y: scroll !important;
    min-height: 320px;
}
@media (min-width: 768px) {
	#files {
		min-height: 300;
	}
}

image.

Now it looks like this: image.

I also had to tweak the scrolling script to force the currently-uploading file to be visible at all times. It looks like this:

function scrollToView(element, parent) {
    element = $(element);
    parent = $(parent);

    var tMarg = parseInt(element.css("margin-top"));
    var bMarg = parseInt(element.css("margin-bottom"));
    var height = element.innerHeight() + tMarg + bMarg;
    var offset = element.position().top;
    var offset_end = element.position().top + height;
    var visible_area_start = parent.scrollTop();
    var visible_area_size = parent.innerHeight();

    //console.log("offset=",offset,"visible_area_start=",visible_area_start,"offset_end=",offset_end,"visible_area_size=",visible_area_size);

    if (offset < 0) {
        parent.animate({scrollTop: offset}, 50);
        return false;
    } else if (offset_end > visible_area_size) {
        parent.animate({scrollTop: parent.scrollTop() + height}, 50);
        return false;
    }

    return true;
}