Skip to main content
forgotten var
Source Link
penkovsky
  • 1k
  • 12
  • 14

For those who use jQuery http://jsfiddle.net/EppA2/2/http://jsfiddle.net/EppA2/3/

function getRows(selector) { var height = $(selector).height(); var line_height = $(selector).css('line-height'); line_height = parseFloat(line_height)   var rows = height / line_height; return Math.round(rows); } 

For those who use jQuery http://jsfiddle.net/EppA2/2/

function getRows(selector) { var height = $(selector).height(); var line_height = $(selector).css('line-height'); line_height = parseFloat(line_height) rows = height / line_height; return Math.round(rows); } 

For those who use jQuery http://jsfiddle.net/EppA2/3/

function getRows(selector) { var height = $(selector).height(); var line_height = $(selector).css('line-height'); line_height = parseFloat(line_height)   var rows = height / line_height; return Math.round(rows); } 
Use Math.round to get correct integer value
Source Link
penkovsky
  • 1k
  • 12
  • 14

For those who use jQuery http://jsfiddle.net/EppA2/1/http://jsfiddle.net/EppA2/2/

function getRows(selector) { var height = $(selector).height(); var line_height = $(selector).css('line-height'); line_height = parseFloat(line_height) rows = height / line_height; return parseIntMath.round(rows); } 

For those who use jQuery http://jsfiddle.net/EppA2/1/

function getRows(selector) { var height = $(selector).height(); var line_height = $(selector).css('line-height'); line_height = parseFloat(line_height) rows = height / line_height; return parseInt(rows); } 

For those who use jQuery http://jsfiddle.net/EppA2/2/

function getRows(selector) { var height = $(selector).height(); var line_height = $(selector).css('line-height'); line_height = parseFloat(line_height) rows = height / line_height; return Math.round(rows); } 
Source Link
penkovsky
  • 1k
  • 12
  • 14

For those who use jQuery http://jsfiddle.net/EppA2/1/

function getRows(selector) { var height = $(selector).height(); var line_height = $(selector).css('line-height'); line_height = parseFloat(line_height) rows = height / line_height; return parseInt(rows); }