Skip to content

Instantly share code, notes, and snippets.

@joanhard
Last active January 25, 2016 20:56
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save joanhard/6375966 to your computer and use it in GitHub Desktop.
Save joanhard/6375966 to your computer and use it in GitHub Desktop.
Make full height colum on css foundation zurb
<div class="row">
<div class="large-8 column">
<div class="main">My Main</div>
</div>
<div class="large-4 column full-height">
<aside class="sidebar">
My Sidebar
</aside>
</div>
</div>
$(".full-height").height($(".main").parent().height());
.full-height { display: table; }
.sidebar {
display: table-cell;
background: #eeeeee;
}
@gstricklind
Copy link

I've been trying to do something similar in Foundation. Your code helped me come closer than anything else I've tried. The only thing is, the full-height column appears just as tall for small devices as it does for desktop. Is there any way to run the script only for desktop? I've tried using checkSize but it doesn't seem to work.

function checkSize(){
if ($(window).width() > 768) {
$(".full-height").height($("body").parent().height());
}
}

You can see the problem here if you view it on a phone or tablet (or resize the browser): http://ginastricklind.com/test/index.php

@andreawo
Copy link

if (Modernizr.mq('only screen and (min-width: 768px)')) {
$(".full-height").height($(".full-height").parent().height());
}

To adjust after resizing I like this small plugin:
http://forum.jquery.com/topic/the-resizeend-event

@killboxsarah
Copy link

I think this worked like a charm. We are cross device and cross browser checking in the morning, but if this worked like I think it did I owe you a hug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment