- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Javascript For Div Height
I have a small script that runs and makes sure that two of my divs are the same height and if not, then gives them the same height.
I’m trying to find a way to modify it to work with my Foundation3 layout. Once the scree is resized to a certain width or it’s viewed from a mobile device, i need the two divs to just take on their auto height.
This is the code that I currently have.
var maxHeight = 0;
$(‘div.jHeight’).each(function() {
if (maxHeight < $(this).height()) {maxHeight = $(this).height()}
if (maxHeight < $('#content-section').height()) { maxHeight = $('#content-section').height()}
});
$(‘div.jHeight’).each(function(){
$(this).Height(“maxHeight”);
});
Hi Maddtechwf!
I really like the [jQuery .map() example](http://api.jquery.com/map/#example-2). But if you need a bit more functionality, check out the [Equalizer](https://github.com/CSS-Tricks/Equalizer) plugin.
If one div takes prescendence over the other then JS is your solution, but for mobile couldn’t you target a mobile.css and have the widths to auto? Mobile detection would be pretty good as well? Lookup some HTML5 boilerplates and a document inspector like modernizr