I'm trying to get the number of lines in an h4 so I can align them across a row. Basically, I have a category page, and I want to middle align the product names.
The idea is to determine how many lines each one fills, then add the appropriate class.
I want it to be dynamic as possible, so I'd prefer not to set any variables in the javascript. I was hoping I could do something like this:
Is there any way to get the number of lines? Or have line height return a pixel value?Code:var height = $(this).height(); // returns 45 var lineHeight = $(this).css('line-height'); // returns normal - ideally, if it were 3 lines, it'd return 15 var numLines = height/numLines // returns 3


Reply With Quote
Bookmarks