0

我正在使用带有 WordPress 主题的灯箱。它在 lightbox.js 文件中定义了一些图像路径。例如

this.fileLoadingImage = '/images/lb-loading.gif';

因此,如果我将上述路径更改为以下路径以从主题目录中获取图像:

this.fileLoadingImage = 'wp-content/themes/mytheme/images/lb-loading.gif';

它仅适用于主页。但它不适用于其他页面。上述路径在其他页面上无效。那么如何动态获取图像目录的完整路径呢?

4

1 回答 1

1

如果您希望在所有页面上都可以看到图像,则必须使用绝对路径。尝试像这样添加/之前wp-content

this.fileLoadingImage = '/wp-content/themes/mytheme/images/lb-loading.gif';
于 2012-11-04T12:25:00.843 回答