本文介绍了自定义信息框中不显示关闭按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我尝试在页面中添加CSS。 它删除信息框的水平滚动条,但我的关闭按钮是也删除。 即使我有 给予 js代码显示关闭按钮 请帮忙做什么来在信息框中显示关闭按钮。 var infoboxTemplate ='< div class =" infobox-info"> {description}< / div>'; var infobox = new Microsoft.Maps.Infobox(point,{ ; htmlContent:infoboxTemplate.replace('{description}',info),visible:false,showCloseButton:true }); 我的CSS是 .infobox-info { white-space:pre-wrap; / * CSS3 * / ; $ white-space:-moz-pre-wrap; / * Firefox * / white-space :-pre-wrap; / * Opera< 7 * / white-space:-o-pre-wrap; ; / * Opera 7 * / 自动换行:break-word; / * IE * / overflow-x:hidden; border:1px solid#888; background-color:White; } $ < / style> 谢谢和问候: Neha Neha 解决方案 如下所述: https://msdn.microsoft.com/en-us/ library / mt712658.aspx 如果设置了自定义HTML,则会忽略某些信息框选项(标题,描述,maxHeight,maxWidth,操作, showCloseButton ,showPoint)。 如果您想要关闭按钮的自定义信息框,请参阅以下示例: http://bingmapsv8samples.azurewebsites.net/#Custom%20Infobox%20HTML%20Content 。I tried adding above CSS in my page .it remove horizontal scroll bar for infobox but my close button is also remove .Even though i have given in js code to display close button Please help what to do to display close button in infobox. var infoboxTemplate = '<div class="infobox-info">{description}</div>';var infobox = new Microsoft.Maps.Infobox(point, { htmlContent: infoboxTemplate.replace('{description}', info),visible: false,showCloseButton: true });and my CSS is .infobox-info{ white-space: pre-wrap; /* CSS3 */ white-space: -moz-pre-wrap; /* Firefox */ white-space: -pre-wrap; /* Opera <7 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* IE */ overflow-x:hidden; border: 1px solid #888; background-color:White;}</style>Thanks & Regards:NehaNeha 解决方案 As documented here:https://msdn.microsoft.com/en-us/library/mt712658.aspx some infobox options are ignored if custom HTML is set (title, description, maxHeight, maxWidth, actions,showCloseButton, showPoint).If you want to have custom infobox with close button see following sample:http://bingmapsv8samples.azurewebsites.net/#Custom%20Infobox%20HTML%20Content. 这篇关于自定义信息框中不显示关闭按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-18 23:03