tristanguigue / angular-dynamic-layout

A lightweight AngularJS dynamic grid layout
http://tristanguigue.github.io/angular-dynamic-layout/
78 stars 35 forks source link

Getting dynamic height of the dynamic-layout div #24

Open JeanHules opened 9 years ago

JeanHules commented 9 years ago

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?

irealva commented 8 years ago

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

tristanguigue commented 8 years ago

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

irealva commented 8 years ago

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?

netstyler commented 8 years ago

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.

tristanguigue commented 8 years ago

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.

netstyler commented 8 years ago

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?

burzum commented 8 years ago

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.

netstyler commented 8 years ago

@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

tristanguigue commented 8 years ago

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

netstyler commented 8 years ago

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