/ Published in: JavaScript
                    
                                        Thanks to Matt Farina
This snippet is useful for preloading content with media that has been received via an AJAX request. For simple preloading of known images, see similar snippet.
                This snippet is useful for preloading content with media that has been received via an AJAX request. For simple preloading of known images, see similar snippet.
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
 // preloading function for arbitrary content (which usually contains images) jQuery.preloadContent = function(){ for(var i = 0; i<arguments.length; i++) { jQuery("<div>").html(arguments[i]); } }; // use like (myvar being a JS variable with content to preload) $.preloadContent(myvar1, myvar2);
URL: http://www.innovatingtomorrow.net/2008/04/30/preloading-content-jquery
Comments
                    Subscribe to comments
                
                