Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

trying to preload images that are the rollover state in a rollover image menu inside a ss template

Go to End

2 Posts   1382 Views


Community Member, 137 Posts

15 April 2010 at 5:01pm

Edited: 15/04/2010 5:02pm

I am trying to preload the hover images for a rollover/image swap menu in a ss template . (the menu itself is not depending on any ss content, it is a menu I have place in the template)

From my ss template I have.
<script type="text/javascript" src="/{$ThemeDir}/js/preloadmyimages.js"></script>

Here is my preloadmyimages.js, the path to this file correct because my debug window below works .

if (document.images)

pic1= new Image(52,70);

window.alert('this is my debug message, my path to this file works')

These directories are all in the same (my template name folder in a standard ss template setup)

but in this present state the images are still not preloading (thus I have to wait a second for the rollover/image swap to happen on the first time, making the menu look buggy).

I'm pretty sure it's not a path issue (I think all my pathing there is right), must be something else going on with the JS or something. Not sure if SS is effecting it somehow.

Any help would be great


Community Member, 137 Posts

15 April 2010 at 7:39pm

worked it out had to reference my images inside JS like.


Which I dont really understand.