0

我有以下JS代码:

applyBefore: {
            backgroundImage: 'url(/myPath/furniture/images/careers/birds/pigeon_flap_medium.gif?' + Math.random() + ')',
            contentFlyOut: {
                direction: 'top',
                delay: 0.5,
                node: '#our-history-content'
            }
        }

...这很好,但是,我需要'/myPath'的值是一个名为'binaryContextRoot'的变量的值,因为这段代码将在不同的服务器上运行,其中'binaryContextRoot'的值将因服务器而异.

我正在努力使用正确的语法在“url”路径中获取“binaryContextRoot”。

我努力了:

backgroundImage: 'url("+binaryContextRoot+"/furniture/images...

其中“binaryContextRoute”是“/myPath”,但没有成功。无法识别/找到路径,因此显然“+binaryContextRoot+”的值不正确。

有人可以帮忙吗?:)

非常感谢

4

1 回答 1

6
backgroundImage: 'url(' + binaryContextRoot + '/furniture/images...'
于 2012-09-18T12:23:32.783 回答