У меня есть карта, и я хочу показать число в каждой стране. Я даю x, y позицию на странице. Но переместите мой код на другую страницу x, y позиция сдвигается. Над каждым городом должна быть только одна коробка.
$(function () {
$("#map svg path").each(function () {
var id=$(this).attr("id");
$("#sehir").text(id);
$(this).html(id);
if ($("#" + id).length > 0) {
var k = $("#" + id).position();
var x = "", y = "";
x = k.left - 110, y = k.top + 20;
$.ajax({
url: '<%=ResolveUrl("~/Default.aspx/GetDeger") %>',
data: '{prefix: ' + JSON.stringify(id) + '}',
dataType: "json",
type: "POST",
context: this,
contentType: "application/json; charset=utf-8",
success: function (data) {
$("#map").append("<a href='https://www.elemanhavuzu.com/'><div class='kutu' style='left:" + x + "px;top:" + y + "px;' data-toggle='tooltip' title="+id+"><b> " + data.d + "</b></div></a> ");
if (data.d != null)
{
var i = +(data.d);
if (i == 0) {
$(this).attr("style", "fill:#C12E3F");
}
else if (i > 0 && i <= 10) {
$(this).attr("style", "fill:#FFD28B");
}
else if (i > 10 && i <= 20) {
$(this).attr("style", "fill:#4dbc83");
}
else if (i > 20) {
$(this).attr("style", "fill:#40A556");
}
}
},
error: function (response) {
alert(response.responseText);
},
failure: function (response) {
alert(response.responseText);
}
});
}
});
})
выглядит сейчас;
![enter image description here](https://i.stack.imgur.com/vqURW.png)