在 ASP.NET 母版页中使用 LightBox
我在网站上使用带有母版页的 LightBox v2.0.4,但遇到了 loading.gif 和 closelabel.gif 图像出现的问题。我的内容页面位于距根目录 3 层的文件夹中,它们的母版页位于距根目录 2 层的文件夹中,相关图像位于 ~/images/ 中,而 javascript 文件位于 ~/js/ 中。例如:
〜/categories/category/subcategory/contentpage.aspx
〜/categories/master.aspx
〜/images/loading.gif
~/images/closelabel.gif
我尝试将 lightbox.js 脚本文件中图像的路径更改为 ~/images/loading.gif 和 ~/images/closelabel.gif,但这并没有'不工作。我一直在通过谷歌搜索网络,但没有找到任何答案......这里有人知道问题是什么吗?
韦恩
I am using LightBox v2.0.4 with master pages on a web site and am having problems with the loading.gif and closelabel.gif images appearing. I have content pages residing in folders that are 3 layers in from the root, their master page is 2 layers in from root, images in question are in ~/images/, and the javascript files are in ~/js/. e.g.:
~/categories/category/subcategory/contentpage.aspx
~/categories/master.aspx
~/images/loading.gif
~/images/closelabel.gif
I have tried changing the path to the images in the lightbox.js script file to ~/images/loading.gif and ~/images/closelabel.gif, but that didn't work. I have been digging around the 'net via Google and haven't found any answers ... does anyone here know what the problem is?
Wayne
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您不能在 .js 文件中使用 ~/images...etc 。您必须使用相对于 .js 文件位置的路径。
You can't use ~/images...etc in the .js files. You have to use the path relative to your .js file location.
尝试通过域根目录的完整路径引用这些图像,以 / 开头(例如“/images/loading.gif”),不带 ~ 但以斜杠开头。
try referencing these images by full path from the domain root starting with / (e.g. '/images/loading.gif') without ~ but with starting slash.
检查 lightbox.js 文件中这两个文件的路径:
并确保母版页正确引用了 js 文件 - 上次我在母版页中得到了正确的结果,VS 显示了红色的波浪线,但它正在工作 :-)
Check the paths to these two files in the lightbox.js file:
And make sure that the master page is referencing the js files correctly - last time I got this correct in the master page, VS was showing the red squiglies, but it was working :-)