我正在<table>
使用 PHP 生成一个(我从 MySQL 数据库中获取值),然后我使用这个脚本将它分解成更小的表:
$(document).ready(function(){
// Get the table
var table = $('#slideshow > table')
var maxHeight = 600;
// While table is to long
while(table.height() > maxHeight) {
// Create a new table to append the rows to
var newTable = $('<table cellspacing="0"></table>');
// Keep track of the height of this new table
var newHeight = 0;
while (true) {
// Get the first row of the original table
var row = table.find('tr:first-child');
if (!row.length) {
break; // No rows left
}
var rowHeight = row.height();
if (newHeight == 0 || // At least have one row
newHeight + rowHeight <= maxHeight) // Would fit
{
// Update new height
newHeight += rowHeight;
// Append row to new table
newTable.append(row);
} else {
// New table is 'full'
break;
}
}
// Insert newTable before the original table
table.before(newTable);
}
然后我使用jQuery Cycle All
脚本将它们一一显示为幻灯片。有没有办法在显示最后一个表格后刷新页面?