0
相应类
的属性我有一个JSON,其中包括以下内容,Jquery的:获得
OverlaySpaceID = 1, id = "example-overlay1", px = 0, py = 0, width = 100, height = 100, className = "highlight" ,location = "https://www.google.co.in"
我使用以下代码解析JSON,
$.ajax({
type: "Get",
async: false,
dataType: "json",
url: '***/OverlayJson',
success: function (data) {
over = data;
},
error: function (httpReq, status, exception) {
alert(status + " " + exception);
}
});
我使用JSON在天珠图像如下
OpenSeadragon({
id: "example-zoomit-tilesource",
prefixUrl: "openseadragon/images/",
tileSources: [{
Image: {
xmlns: 'http://schemas.microsoft.com/deepzoom/2008',
Url: "http://cache.zoom.it/content/WwI0_files/",
Format: 'jpg',
Overlap: "0",
TileSize: "256",
ServerFormat: "Default",
Size: {
Width: "5816",
Height: "3961"
}
},
overlays: over //json
}, ]
});
JSON被映射到一个天顶图像作为叠加。当我点击它时,我需要'位置'的值 JSON字段。
jQuery(function() {
setTimeout(bindtooltip, 2000);
});
function bindtooltip() {
jQuery('.highlight').click(function() {
var status = $(this).attr('id') //works fine
var loc = $(this).attr('location') // not working
alert(status);
alert(loc);
// window.location.href=loc;
});
}
我该如何获得位置?
请参阅the link
当你从你的JSON – zerkms
更新了我的问题,阅读我没有看到 –
@ErmaIsabel,是否有可能将您的代码粘贴到jsfiddle.net中。并分享链接 –