Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jamosonic/399344 to your computer and use it in GitHub Desktop.
Save jamosonic/399344 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function() {
var preloadImage = function(url) {
console.log('preload: %s', url);
document.createElement('img').src = url;
};
var getImageUrl = function(id, state) {
var matches;
if (matches = jQuery('head style').html().match( (new RegExp('#' + id + ':' + state + '\\s*{\\s*background-image:\\s*url\\((.*)\\)')) )) return matches[1];
};
preloadImage(getImageUrl('lp-pom-button-14', 'hover'));
preloadImage(getImageUrl('lp-pom-button-14', 'active'));
});
@leadlike
Copy link

leadlike commented Jul 4, 2013

not working... whene do we have to install it ? After Body tag ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment