Get Number of Lines
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.
Is there any way to get the number of lines? Or have line height return a pixel value?
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
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)