我正在根据我已经在数组中添加的 css 位置在地图上一一添加点。
var postop =[{'top':'23'},{'top':'84'},{'top':'54'},{'top':'76'},{'top':'103'}];
var posleft =[{'left':'23'},{'left':'34'},{'left':'34'},{'left':'56'},{'left':'103'}];
但我想根据坐标在地图上一一添加点。
var coordsx =[{'x':'155'},{'x':'338'},{'x':'236'},{'x':'196'},{'x':'171'}];
var coordsy =[{'y':'238'},{'y':'328'},{'y':'488'},{'y':'164'},{'y':'439'}];
我的脚本在这里:
var position = 0;
var postop =[{'top':'23'},{'top':'84'},{'top':'54'},{'top':'76'},{'top':'103'}];
var posleft =[{'left':'23'},{'left':'34'},{'left':'34'},{'left':'56'},{'left':'103'}];
$(postop).each(function(i){
var dots=$('<img src="http://i.imgur.com/iAfzQ.jpg" />');
dots.css('position','absolute');
dots.offset({ top: postop[position].top, left: posleft[position].left });
$("#overlay-dots").append(dots);
position++;
i++;
});