Search Options
close
Search the following clips:
All Clips
Everyone's Clips
My Guides
Sign Up
Install
Learn More
Login
jQuery - Columns of Equal Height
VernonK
follow
0
6-29-2009 9:22 AM
29 views
tags:
jquery
Add a Comment
Login
to Comment. Not a member yet?
Sign up
Today's Top Clips
This dog needed a hero – and got one!
I DO NOT
Marine reservist attacks Greek priest with tire iron, says "He's a terrorist!"
Fox News Declares Cyberwar on Liberal Blogosphere
Winter Woolies
Hey Dudes!: The Beatles album from a parallel dimension
Colorization
Intelligent Jokes
Israel continues to destroy olive trees
How the US Funds the Taliban
visit the
Top Clips page
View the Top Clips from
June 29, 2009
Embed This Clip In Your Site...
<div style="margin: 12px 0px; font-family: arial; color: #333333; background: #ffffff; border: solid 4px #e5e5e5; width: 100%; clear: left;"><div class="CM_CTB_Content_Wrap" style="margin: 0px; padding: 0px;background-color: #ffffff;"><div style="border-bottom: solid 1px #dcdcdc; white-space: nowrap; margin-bottom: 8px; background-color: #eeeeee ;background-image: url(http://clipmarks.com/images/source-bg.gif); background-repeat: repeat-x; height: 24px; line-height: 24px; vertical-align: middle; padding-bottom: 4px; color: #666666; font-size: 10px;" ><a href="http://clipmarks.com/clip-to-blog/" title="see clips that are hot right now"><img src="http://content.clipmarks.com/blog_embed/134cb1e9-517d-4a81-af45-1198cf290fdb/B97D7BD9-0A3A-4405-91B0-4478E70B8E71/" alt="" width="19" height="19" border="0" style="vertical-align: middle; margin: 0px 4px; display: inline; border: none; float:none;" /></a>clipped from <a title="http://www.queness.com/post/126/useful-and-handy-jquery-tips-and-tricks" href="http://www.queness.com/post/126/useful-and-handy-jquery-tips-and-tricks" style="font-size: 11px;">www.queness.com</a></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.queness.com/post/126/useful-and-handy-jquery-tips-and-tricks"><LI class="alt"><SPAN><SPAN>$(document).ready(</SPAN><SPAN class="keyword">function</SPAN><SPAN>() { </SPAN></SPAN></LI><LI class=""><SPAN> setHeight(<SPAN class="string">'.col'</SPAN><SPAN>); </SPAN></SPAN></LI><LI class="alt"><SPAN>}); </SPAN></LI><LI class=""><SPAN> </SPAN></LI><LI class="alt"><SPAN><SPAN class="comment">//global variable, this will store the highest height value</SPAN><SPAN> </SPAN></SPAN></LI><LI class=""><SPAN><SPAN class="keyword">var</SPAN><SPAN> maxHeight = 0; </SPAN></SPAN></LI><LI class="alt"><SPAN> </SPAN></LI><LI class=""><SPAN><SPAN class="keyword">function</SPAN><SPAN> setHeight(col) { </SPAN></SPAN></LI><LI class="alt"><SPAN> <SPAN class="comment">//Get all the element with class = col</SPAN><SPAN> </SPAN></SPAN></LI><LI class=""><SPAN> col = $(col); </SPAN></LI><LI class="alt"><SPAN> </SPAN></LI><LI class=""><SPAN> <SPAN class="comment">//Loop all the col</SPAN><SPAN> </SPAN></SPAN></LI><LI class="alt"><SPAN> col.each(<SPAN class="keyword">function</SPAN><SPAN>() { </SPAN></SPAN></LI><LI class=""><SPAN> </SPAN></LI><LI class="alt"><SPAN> <SPAN class="comment">//Store the highest value</SPAN><SPAN> </SPAN></SPAN></LI><LI class=""><SPAN> <SPAN class="keyword">if</SPAN><SPAN>($(</SPAN><SPAN class="keyword">this</SPAN><SPAN>).height() > maxHeight) { </SPAN></SPAN></LI><LI class="alt"><SPAN> maxHeight = $(<SPAN class="keyword">this</SPAN><SPAN>).height();; </SPAN></SPAN></LI><LI class=""><SPAN> } </SPAN></LI><LI class="alt"><SPAN> }); </SPAN></LI><LI class=""><SPAN> </SPAN></LI><LI class="alt"><SPAN> <SPAN class="comment">//Set the height</SPAN><SPAN> </SPAN></SPAN></LI><LI class=""><SPAN> col.height(maxHeight); </SPAN></LI><LI class="alt"><SPAN>} </SPAN></LI></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.queness.com/post/126/useful-and-handy-jquery-tips-and-tricks"><LI class="alt"><SPAN><SPAN class="tag"><</SPAN><SPAN class="tag-name">div</SPAN><SPAN> </SPAN><SPAN class="attribute">class</SPAN><SPAN>=</SPAN><SPAN class="attribute-value">"col"</SPAN><SPAN> </SPAN><SPAN class="attribute">style</SPAN><SPAN>=</SPAN><SPAN class="attribute-value">"border:1px solid"</SPAN><SPAN class="tag">></SPAN><SPAN>Column One</SPAN><SPAN class="tag"><</SPAN><SPAN class="tag-name">br</SPAN><SPAN class="tag">/></SPAN><SPAN> </SPAN></SPAN></LI><LI class=""><SPAN>With Two Line<SPAN class="tag"><</SPAN><SPAN class="tag-name">br</SPAN><SPAN class="tag">/></SPAN><SPAN> </SPAN></SPAN></LI><LI class="alt"><SPAN>And the height is different<SPAN class="tag"><</SPAN><SPAN class="tag-name">br</SPAN><SPAN class="tag">/></SPAN><SPAN class="tag"><</SPAN><SPAN class="tag-name">br</SPAN><SPAN class="tag">/></SPAN><SPAN> </SPAN></SPAN></LI><LI class=""><SPAN><SPAN class="tag"></</SPAN><SPAN class="tag-name">div</SPAN><SPAN class="tag">></SPAN><SPAN> </SPAN></SPAN></LI><LI class="alt"><SPAN><SPAN class="tag"><</SPAN><SPAN class="tag-name">div</SPAN><SPAN> </SPAN><SPAN class="attribute">class</SPAN><SPAN>=</SPAN><SPAN class="attribute-value">"col"</SPAN><SPAN> </SPAN><SPAN class="attribute">style</SPAN><SPAN>=</SPAN><SPAN class="attribute-value">"border:1px solid"</SPAN><SPAN class="tag">></SPAN><SPAN>Column Two</SPAN><SPAN class="tag"><</SPAN><SPAN class="tag-name">br</SPAN><SPAN class="tag">/></SPAN><SPAN class="tag"><</SPAN><SPAN class="tag-name">br</SPAN><SPAN class="tag">/></SPAN><SPAN class="tag"></</SPAN><SPAN class="tag-name">div</SPAN><SPAN class="tag">></SPAN><SPAN> </SPAN></SPAN></LI></blockquote><div style="height: 2px; font-size: 2px; background: #dcdcdc; border-bottom: solid 1px #f5f5f5; margin: 2px 4px;"></div><blockquote style="text-align: left; padding: 0px 8px; margin: 4px 0px 8px 0px; background: transparent; border: none;" cite="http://www.queness.com/post/126/useful-and-handy-jquery-tips-and-tricks"><H2>Columns of equal height</H2> I think this script is quite useful. I haven't have a chance to use it yet. It's more on design. If you want columns have the same height, this function will answer your request.</blockquote></div><div style="margin: 0px 6px 6px 4px;"><table style="font-size: 11px;border-spacing: 0px;padding: 0px;" cellpadding="0" cellspacing="0" width="100%"><tr><td style="background:transparent;border-width:0px;padding:0px;"> </td><td align="right" style="background:transparent;border-width:0px;padding:0px;width:107px" width="107"><a href="http://clipmarks.com/share/B97D7BD9-0A3A-4405-91B0-4478E70B8E71/blog/" title="blog or email this clip"><img src="http://content9.clipmarks.com/images/c2b-foot.png" border="0" alt="blog it" width="107" height="17" style="border-width:0px;padding:0px;margin:0px;" /></a></td></tr></table></div></div>
New from the makers of Clipmarks:
Amplify.com - Don't just share the news...Amplify it!
Clipmarks
Home
New Clips
Top Clips
Dashboard
Popular Topics
News
Life
Science
Technology
Entertainment
Get Started
Sign Up
Install Clipping Tool
How Clipping Works
Clip-to-Blog™
ClipSearch
Tools and Resources
FAQ
ClipWeek
Top Clippers
Top Tags
Site Map
About Clipmarks
About Us
Contact
Copyright
Privacy
EULA
OK