angular-dynamic-layout icon indicating copy to clipboard operation
angular-dynamic-layout copied to clipboard

Getting dynamic height of the dynamic-layout div

Open JeanHules opened this issue 9 years ago • 10 comments

Great directive, but I can't seem to get the height of the container, 'dynamic-layout' which contains all of the cards. I see on your example, there is the same issue.

http://tristanguigue.github.io/angular-dynamic-layout/

I see you've mentioned something about a timeout, but that doesn't seem to work for me. Any ideas?

JeanHules avatar Oct 23 '15 19:10 JeanHules

Hi, I'd love to get an answer to JeanHules's question. I'm having the same issue!

irealva avatar Dec 29 '15 18:12 irealva

Sorry for the delay, if you take the scrollHeight of the element it should work

tristanguigue avatar Jan 05 '16 09:01 tristanguigue

So I'm still having issues with this because I need to make a calculation (using scrollHeight) each time a page is loaded with the dynamic layout container. Is there any way to make the parent div take up the whole space of the isotope items?

irealva avatar Jan 17 '16 18:01 irealva

I did also not manage to get height based on scrollheight running. Always fails on xs devices. Would be great to have a solution for the height issue.

netstyler avatar Jan 31 '16 17:01 netstyler

The problem is due to the absolute positioning of the elements. Unfortunately I don't have an easy solution or the time to look for it for now. If anyone does please let me know or send me a pull request.

tristanguigue avatar Jan 31 '16 19:01 tristanguigue

I tried this:

function layout() {
    angular.element('.auto-height').css('height', (element[0].scrollHeight) );
    return PositionService.layout(element[0].offsetWidth);
}

unfortunately it has on chrome the height is around 60px to much. And when it gets to the xs size of the site the height is around 10% to small.

Any idea why this happens?

netstyler avatar Jan 31 '16 19:01 netstyler

Unfortunately I don't have an easy solution or the time to look for it for now.

@tristanguigue would you mind sharing your not so easy idea of how to resolve this with us? I don't mind implementing it if I would know how to tackle the problem at all.

burzum avatar Feb 02 '16 14:02 burzum

@tristanguigue I fixed this issue now this way: https://github.com/netstyler/angular-dynamic-layout/commit/a1c3b78dc680a1d38513cc62b3c95022524dda08

On my application it is working now perfectly with elements after

See also other commits I did in my fork https://github.com/netstyler/angular-dynamic-layout/commits/feature/24

netstyler avatar Feb 04 '16 09:02 netstyler

Thanks @netstyler that seems like the only way to go indeed do you mind submitting a Pull Request with those changes?

tristanguigue avatar Feb 06 '16 19:02 tristanguigue

Your welcome. And thanks also for your work! Pull request done ;)

netstyler avatar Feb 06 '16 19:02 netstyler