If you choose to load the image with dimensions of just 1px
wide and 1px
tall, your scrolling experience will remain unaffected. Here's a handy CSS/HTML trick for loading large images:
<img src="http://placekitten.com/1000/1000" width="1" height="1" onload="this.style.height = 'auto'; this.style.width = 'auto';">
Start by loading the image at a size of 1px, then let it display normally once the loading is complete.
If you prefer to load the image only after the body has fully loaded, give this a try:
function initBanner(){
var bannerSrc = "http://placekitten.com/1000/1000";
// stores the image's source URL
var banner = document.getElementById('banner1');
// refers to the image object
banner.src = bannerSrc;
// sets the image source
}
<body onload="initBanner()">
<!-- call the initBanner() function once the body has finished loading -->
<img id="banner1" src="" />
</body>