Set height of each tables = Tallest table in class
Dear All
Objective
Set height of each tables = Tallest table in class
JQUERY used is listed below ... it is not working
- <script type="text/javascript">
$(document).ready(function() {
$.fn.delay = function(time, callback){
// Empty function:
jQuery.fx.step.delay = function(){};
// Return meaningless animation, (will be added to queue)
return this.animate({delay:1}, time, callback);
}
var maxHeight; //<<<------------------------------------------------------code start from here
$('.testimonials').each(function() {
maxHeight = Math.max(maxHeight, $(this).height());
}).height(maxHeight);
});
</script>
With this all table of the class will have same heights.
html part These tables are created dynamically from Database using PHP-MySQL
- <table width="98%" border="0" cellspacing="1" cellpadding="0" bgcolor="#CCCCCC" height="100%" id='<?php echo 'testimonials'.$rows['id'];?>' class='testimonials' >
<tr >
<td bgcolor="#006699" style="font-family: 'Nova Square', sans-serif; font-size:20px; color:#ffffff;" height="30px"; > <?php echo $rows['name'];?></td>
</tr>
<tr>
<td bgcolor="#eeeeee" style="font-family: 'Homenaje', sans-serif; font-size:21px; color:#ff0000;" height="30px; " ; > <?php echo $rows['tourname'];?></td>
</tr>
<tr>
<td bgcolor="#eeeeee" valign="top" background="rough_diagonal.jpg"><table width="94%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="justify" class="text14blue"><?php echo $rows['detail'];?></td>
</tr>
</table></td>
</tr>
</table>
Complete do - while Loop that creates these tables
Can be see in in following webpage
http://www.webvikas.net.in/himashree/Himashree-Testimonials
- <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<?php $query= sprintf("SELECT * FROM testimonials where status=1 order by srno");
mysql_select_db($database_DBconnect, $DBconnect);
$Result = mysql_query($query , $DBconnect) or die(mysql_error());
$rows = mysql_fetch_assoc($Result);
$totalrows=mysql_num_rows($Result);
$i=0;
do { $i++;
?> <td valign="top" width="28%" height="100%" ><table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="3%" height="100%"> </td>
<td width="97%" height="100%"><table width="98%" border="0" cellspacing="1" cellpadding="0" bgcolor="#CCCCCC" height="100%" id='<?php echo 'testimonials'.$rows['id'];?>' class='testimonials' >
<tr >
<td bgcolor="#006699" style="font-family: 'Nova Square', sans-serif; font-size:20px; color:#ffffff;" height="30px"; > <?php echo $rows['name'];?></td>
</tr>
<tr>
<td bgcolor="#eeeeee" style="font-family: 'Homenaje', sans-serif; font-size:21px; color:#ff0000;" height="30px; " ; > <?php echo $rows['tourname'];?></td>
</tr>
<tr>
<td bgcolor="#eeeeee" valign="top" background="rough_diagonal.jpg"><table width="94%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="justify" class="text14blue"><?php echo $rows['detail'];?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="100%" colspan="2" > </td>
</tr>
</table></td>
<?php if ($i > 2) { $i=0; echo "</tr><tr>
<tr><td colspan=3 height=8> </tr>
<tr><td colspan=3>
<table width='100%'><tr><td width=10px> </td><td bgcolor='#ccc' height=1> </td><td width=10px> </td> </tr></table>
</td></tr>
<tr><td colspan=3 height=8> </tr>"; }
} while ($rows = mysql_fetch_assoc($Result));
if ($i== 1) { echo "<td></td> <td></td></tr> "; }
if ($i== 2) { echo "<td></td> </tr>"; }
?>
</tr>
<tr><td background="<?php echo PATH;?>images/aboutus_05.jpg">
</td></tr>
</table>