Jump to:

23487 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » trying to preload images that are the rollover state in a rollover image menu inside a ss template

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

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

Page: 1
Go to End
Author Topic: 1080 Views
  • TF-35Lightning
    Avatar
    Community Member
    137 Posts

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

    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);
    pic1.src="../images/ui/nav/n_01home1_on.gif";

    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)
    css
    images
    js
    templates

    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

  • TF-35Lightning
    Avatar
    Community Member
    137 Posts

    Re: trying to preload images that are the rollover state in a rollover image menu inside a ss template Link to this post

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

    ../themes/mysite/images/myimage.gif

    Which I dont really understand.

    1080 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.