0

I'm writing a component in Joomla and want to use JavaScript.

I got the JavaScript part working in a separat test html page, but now I want to include it in the Joomla component.

The problem is the relative file paths for the images. The images are stored in the media folder of joomla:

media/com_component/images

I include the external js-file with this command:

$document->addScript(JURI::Root().'components/com_component/script.js');

In the script I need the path to the image folder. I don't want to hard code the absolute path in the script. How can I get the relative paths? Do/can I use Joomla functions for that?

Thank you

4

1 回答 1

0

I chose to put the file path information in the css file (set the image as the background of the link). This way the js-script is independent of the image's file path.

于 2013-08-14T00:14:02.073 回答