How can you make it so that a webpage loads its structure (the divs, frames, overall appearance) first, then load images one by one? sort of like what this website does -> www.9gag.com
I use mysql queries to display images, see code below
function display_posts($page){
$start=($page*5)-4;
$query="SELECT * FROM `posts` ORDER BY postid DESC LIMIT $start, 5";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
while($row = $result->fetch_assoc()) {
$pic=$row['pic'];
$postid=$row['postid'];
echo "<p class=\"pic_title\">".$row['title']."</p>";
echo "<a href='view.php?img=".$postid ."'><img src='". $pic ."' /></a> ";
}
It takes about 8 seconds to load a complete page of 5 images, but when it does load, the webpage immediately appears complete with all the images, and I want it to load the structure first, then the images. Thanks!