我试图确保信息框弹出窗口内的内容滚动,以便显示所有信息,但是当我尝试使用滚动条在释放鼠标按钮时滚动时,地图会像按住并平移一样粘在这一点上。这是一些要重现的代码:
var location = new Microsoft.Maps.Location(0, 0);
var html = "title<br/>description desc desc"
+ " description desc desc description desc desc"
+ " description desc desc description desc desc"
+ " description desc desc description desc desc"
+ " description desc desc description desc desc"
;
var popupHTML = '<div style="height: 50px; width: 100px; overflow: auto; background: white;">{content}</div>';
var options = {
htmlContent: popupHTML.replace('{content}', html),
visible: true,
};
var popup = new Microsoft.Maps.Infobox(location, options);
map.entities.push(popup);
或者将以下内容粘贴到信息框部分下的必应地图 SDK 中:
map.entities.clear();
var infoboxOptions = {title:'Infobox Title', description:'<div style="height:20px; overflow: auto;">Infobox description description description description description description description description description description description description description description description description description description description<div>'};
var defaultInfobox = new Microsoft.Maps.Infobox(map.getCenter(), infoboxOptions );
map.entities.push(defaultInfobox);
然后尝试向下滚动,当您释放时,地图将卡在该位置,就像您按住并平移一样。
欢迎任何建议,谢谢!