javascript - relative path to images in external js script -


i'm writing component in joomla , want use javascript.

i got javascript part working in separat test html page, want include in joomla component.

the problem relative file paths images. images stored in media folder of joomla:

media/com_component/images

i include external js-file command:

$document->addscript(juri::root().'components/com_component/script.js');

in script need path image folder. don't want hard code absolute path in script. how can relative paths? do/can use joomla functions that?

thank you

i chose put file path information in css file (set image background of link). way js-script independent of image's file path.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -