In my project, I want to display a row of 'cells' which are simply images of black or white squares based on their ID. The issue I am facing is that when the button is clicked, the row list is shown without the CSS applied, and then after a brief delay, the CSS is applied and it displays correctly. Is there a way to reverse this process so that the CSS is applied first and then the table is shown to the user?
CSS
ol, li { display: inline; margin: 0 0 0 0; padding: 0 0 0 0; list-style: none; }
img { margin: 0 0 0 0; padding: 0 0 0 0; }
Jquery
$('#generateTbl').hide();
$('#generateBtn').click(function () {
showCellConfiguration();
});
var showCellConfiguration = function () {
loadCells($('#numOfCells').val());
$('#generateTbl').show('slow', function () { });
}
var loadCells = function (numOfCells) {
for (var i = 0; i < numOfCells; i++) {
$("#row").append('<li><img id="cellOff" class="buttons" src="off.jpg" /></li>');
}
}
HTML
<table id='generateTbl'>
<tr><td><ol id="row"></ol></td></tr>
</table>