BaconBeast321 Posted August 14, 2006 Share Posted August 14, 2006 Hi there, I have many image rollovers on my pages, and I have found that the Rollover occurs a full second later after having moved my mouse over it. I'm assuming this is because I am downloading the 2nd image? These are .gifs around 1-3KB so shouldn't really be big delay.Is there a way to get a user to prep this images on initial load of the page? Quote Link to comment https://forums.phpfreaks.com/topic/17483-preload-images-on-page-load/ Share on other sites More sharing options...
Chetan Posted August 14, 2006 Share Posted August 14, 2006 Display that image somewhere and if you want to hide that image use CSS.I dont think its because the time. You can remove the line which checks if images are loaded in your function.Give a function which you use and I can just modify it.And since this is JS not PHP it shud be in d JS board Quote Link to comment https://forums.phpfreaks.com/topic/17483-preload-images-on-page-load/#findComment-74385 Share on other sites More sharing options...
ToonMariner Posted August 14, 2006 Share Posted August 14, 2006 if this is for a menu then perhaps consider dointh this with css rather than js rollovers.My method of chice is quite simple....you have you two images (say 100 x 80 px) create one image from the two that is 100 x 160 (one above the other)now the images will be in an anchor tag so we can do this....html...<a id="sitemap" href="/sitemap.php" title="Site Map"><span>Site Map</span></a>cssa#sitemap {display: block; width: 100px; height: 80; background: transparent url(../images/bgdad.jpg) no-repeat 0 0;}a:hover#sitemap { background-position: 0 -80px;}a#sitemap span {display: none;}If a user then has css off they will still see the link.....beauty of this is that the 'roll-over' image is already there!!!! Quote Link to comment https://forums.phpfreaks.com/topic/17483-preload-images-on-page-load/#findComment-74391 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.