The code snippet for the popup is as follows:
<div id="commentBox" class="commentBox">
<div class="panel panel-default">
<div class="panel-body">
<input type="text" value="" id="annotationText" />
<button type="button" ng-click="setComment()">OK</button>
</div>
</div>
</div>
CSS Styling:
.commentBox {
position: absolute;
z-index: 9999;
left: 72px;
top: 58px;
display:none;
}
#commentBox:before {
position: absolute;
top: -7px;
left: 1px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
#commentBox:after {
position: absolute;
top: -6px;
left: 0px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
border-left: 6px solid transparent;
content: '';
}
The commentBox:after and commentBox:before elements create a small arrow-tip and shadow on the top-right corner of the commentBox.
There is an issue where clicking on the extreme right-side of the map causes the popup div to show outside the main Map Div. Refer to the screenshots below:
https://i.sstatic.net/bA8nM.png
When clicked somewhere else:
https://i.sstatic.net/NRCwM.png
How can I ensure that this DIV (popup) displays within the limits of the MAP DIV when clicked on the extreme right side?