• Hello,

    I have some buttons that chance appearance when mouse-overed.

    It worked fine until I put the javascript to an external file. Now it’s somehow, not founding the images that should appear when hovered, the button just disappears. I assume that I can use the script just the same manner I used it when it was embedded to the file, right?

    As you see below I link to the images using the stylesheet_directory, could the problem somehow be in this?

    button1up = new Image; button1up.src = "<?php bloginfo('stylesheet_directory'); ?>/images/image1.png";
    	button1down = new Image; button1down.src = "<?php bloginfo('stylesheet_directory'); ?>/images/image2.png";

    And I link to the javascript-file like this:

    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/javascript/buttons.js"></script>

    If some nice person could please give me a hand here. All help appreciated! Thanks 🙂

Viewing 1 replies (of 1 total)
  • Thread Starter hilj

    (@hilj)

    Few minutes after I posted this, I realized that of course the stylesheet_directory wont work cause it’s not anymore in any of the template files.

    i tried to use just src = "/images/image1.png", it didn’t work, I assume it has to be the full path (that works at least).

    But now that makes things more complicated. Like when I put the site online (I’m building it locally) or maybe in future I need to move it to another domain, I need to change them all.

    Is there a good solution to this?

    Thanks again!

Viewing 1 replies (of 1 total)

The topic ‘Little help needed with a javascript issue’ is closed to new replies.