Skip to content

Instantly share code, notes, and snippets.

@robinhayward
Created January 31, 2013 14:36
Show Gist options
  • Save robinhayward/4683245 to your computer and use it in GitHub Desktop.
Save robinhayward/4683245 to your computer and use it in GitHub Desktop.
<!doctype html>
<head>
<title>Preloader Idea - (More than one way to skin pussy cat)</title>
<style>
.preloader-container { display: none; }
</style>
</head>
<body>
<div class="preloader-container">
<script>
var jQuery;
jQuery().ready(function() { preloadPages(1,20); }
function preloadPages(currentPage, numberOfPagesToPreload)
{
var body = jQuery('body');
var preloaderContainer = jQuery('.preloader-container');
for (var pageNumber = currentPage; pageNumber < numberOfPagesToPreload; pageNumber++)
{
var imageTagHTML = '<img src="http://api.com/catalogue/images/pages/page-'+ pageNumber +'.png" width="1" height="1" alt="">';
preloaderContainer.append(imageTagHTML);
}
}
</script>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment