我試圖確保信息框內的信息彈出窗口滾動以顯示所有信息,但是當我嘗試使用滾動條釋放鼠標按鈕時,地圖將像這樣粘貼按住並平移。下面是一些代碼來重現:bing地圖信息框與滾動條
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);
或可選擇地粘貼以下到Bing地圖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);
然後儘量向下滾動,當你鬆開,地圖會堅持那個位置就好像你在按住平移一樣。
歡迎任何建議, 謝謝!
謝謝obi068!似乎工作正常,但需要在關閉信息框時重新添加處理程序。我最終只是在兼容模式下將一個較大的盒子放在一邊,滾動條使Internet Explorer崩潰! –