Elfinder: elfinder height can not be adjust automatic!

Created on 20 Jun 2016  ·  11Comments  ·  Source: Studio-42/elFinder

howto

Most helpful comment

e.g. fit to window size

var elfinderInstance = $('#elfinder').elfinder({
    width: '100%',
    height: height: $(window).height() - 20
}).elfinder('instance');

// fit to window.height on window.resize
var resizeTimer = null;
$(window).resize(function() {
    resizeTimer && clearTimeout(resizeTimer);
    resizeTimer = setTimeout(function() {
        var h = parseInt($(window).height()) - 20;
        if (h != parseInt($('#elfinder').height())) {
            elfinderInstance.resize('100%', h);
        }
    }, 200);
});

All 11 comments

qq 20160620132745

qq 20160620132914
this is the image showing the consequence after change the value of elfinder height

@ExtremeYu option height allow number only. There is typo in code comments. I'll fix it.

Thanks! :+1:

it’s means that the elfinder does not support auto-height?

That's right. It need JavaScript adjustment.

oh that‘s too bad..... is there any way to let elfinder adjust height automaticly ?

e.g. fit to window size

var elfinderInstance = $('#elfinder').elfinder({
    width: '100%',
    height: height: $(window).height() - 20
}).elfinder('instance');

// fit to window.height on window.resize
var resizeTimer = null;
$(window).resize(function() {
    resizeTimer && clearTimeout(resizeTimer);
    resizeTimer = setTimeout(function() {
        var h = parseInt($(window).height()) - 20;
        if (h != parseInt($('#elfinder').height())) {
            elfinderInstance.resize('100%', h);
        }
    }, 200);
});

qq 20160620203433

that's perfect!!!!

I noticed today, that using height: '70%', in client config works. 70% is then converted to pixels automatically uppon window load.
Is this officially supported? Wiki says, that height must be number in pixels: https://github.com/Studio-42/elFinder/wiki/Client-configuration-options-2.1#height

@arnisjuraga Yes, recent versions now accept the "%" designation. The wiki will be fixed.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings