【问题标题】:OpenLayers's CSS breaks after publishing to Azure Web SiteOpenLayers 的 CSS 在发布到 Azure 网站后中断
【发布时间】:2013-02-07 09:01:14
【问题描述】:

我创建了一个使用 OpenLayers 2.12 的非常简单的 ASP.NET 4.5 MVC4 网站。它只有一页显示一张地图,上面有一些点和线。如果我在本地运行它,它运行良好,但在发布到我的 Azure 网站后,OpenLayers 的 CSS 文件将无法加载。我现在已经在我的 bundleConfig 中添加了 OpenLayers CSS 硬编码,现在它可以正常工作了。但当然,这不是我想要的,因为 OpenLayers 有针对其他平台和浏览器版本等的特定 CSS 文件。

在本地,我只需要包含 openlayers.js 和 OpenLayers 然后添加正确的 css 文件。有人知道为什么在发布到 Azure 后这不起作用吗?

【问题讨论】:

    标签: azure openlayers


    【解决方案1】:

    来自 openlayers.js 中的文档:

    Please remember that when your OpenLayers script is not named
    "OpenLayers.js" you will have to make sure that the default theme is
    loaded into the page by including an appropriate <link>-tag,
    e.g.:
    
    (code)
    <link rel="stylesheet" href="/path/to/default/style.css" type="text/css">
    (end code)
    

    因为 Azure 更改了包含的文件名,所以我确实应该自己添加对默认样式的引用。另外,我可以链接到 style.css,其他 css 文件,例如IE6 或 Mobile 不会自动使用,这些只是供您在适当的时候使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多