Anchor Positioning Example
Sometimes when using custom icons you want the anchor point to appear in a different location in relation to the icon. By using the anchorPosition initialization option, you can specify an x/y cooridinate within the icon, or use general instruction like 'top', 'middle', 'bottom', 'left', 'center', and 'right'. When specifiying a numeric x or y cooridinate, the first instruction is the x value, and the second is the y. Default is 'center middle'.
Default: Custom: Custom 2: Custom 3:
Default:
<script type="text/javascript">
new HelpBalloon({
title: 'Default Anchor',
content: 'You can set the position of the anchor '
+ 'using the \'anchorPosition\' option. Possible '
+ 'values are top, middle, bottom, left center and right '
+ 'and any numeric value. It reads it as \'X Y\'',
icon: 'assets/quadrants.gif',
iconStyle: {
'cursor': 'pointer',
'verticalAlign': 'middle'
}
});
</script>
Custom:
<script type="text/javascript">
new HelpBalloon({
title: 'Custom Anchor',
content: 'You can set the position of the anchor '
+ 'using the \'anchorPosition\' option. Possible '
+ 'values are top, middle, bottom, left center and right '
+ 'and any numeric value. It reads it as \'X Y\'',
icon: 'assets/quadrants.gif',
anchorPosition: '37 12',
iconStyle: {
'cursor': 'pointer',
'verticalAlign': 'middle'
}
});
</script>
Custom 2:
<script type="text/javascript">
new HelpBalloon({
title: 'Custom Anchor',
content: 'You can set the position of the anchor '
+ 'using the \'anchorPosition\' option. Possible '
+ 'values are top, middle, bottom, left center and right '
+ 'and any numeric value. It reads it as \'X Y\'',
icon: 'assets/quadrants.gif',
anchorPosition: 'bottom right',
iconStyle: {
'cursor': 'pointer',
'verticalAlign': 'middle'
}
});
</script>
Custom 3:
<script type="text/javascript">
new HelpBalloon({
title: 'Custom Anchor',
content: 'You can set the position of the anchor '
+ 'using the \'anchorPosition\' option. Possible '
+ 'values are top, middle, bottom, left center and right '
+ 'and any numeric value. It reads it as \'X Y\'',
icon: 'assets/quadrants.gif',
anchorPosition: 'right 37',
iconStyle: {
'cursor': 'pointer',
'verticalAlign': 'middle'
}
});
</script>
Post a Comment