这是我想要在jquery函数中导入的hotspot.json文件。我遇到的问题是热点价值上的引号。没有他们的JSON文件无效,但现在它不起作用。在不带引号的jquery函数中导入json文件
[
{
"pitch": 14.1,
"yaw": 1.5,
"cssClass": "custom-hotspot",
"createTooltipFunc": hotspot,
"createTooltipArgs": "Baltimore Museum of Art"
},
{
"pitch": -9.4,
"yaw": 222.6,
"cssClass": "custom-hotspot",
"createTooltipFunc": hotspot,
"createTooltipArgs": "Art Museum Drive"
},
{
"pitch": -0.9,
"yaw": 144.4,
"cssClass": "custom-hotspot",
"createTooltipFunc": hotspot,
"createTooltipArgs": "North Charles Street"
}
]
这就是我在这个时候导入json文件的方法。
var hotspots = (function() {
$.ajax({
'async': false,
'global': false,
'url': "/hotspot.json",
'dataType': "json",
'success': function (data) {
hotspots = data;
}
});
return hotspots;
})();
在这一点上,我不知道从哪里开始。我是否需要在我的json文件中更改某些内容或修复js文件中的问题?有人可以帮我解决这个问题吗?
你能解释为什么你想让这些值没有引号吗? – yarwest
你好yarwest,否则它不工作。通常我必须将热点配置放入函数中。例如:[link](https://pannellum.org/documentation/examples/custom-hot-spots/)但需要它是一个外部文件。 – Damenace
从我能看到你发送的链接中,你想把热点函数放入JSON数据中? – yarwest