getOffsetFromBody()

Returns an object whose left and top properties correspond to the position of the supplied element relative to the document body.

Syntax

var offset = behavior.getOffsetFromBody(element);

Example

var mybehavior = jsb.behavior.extend({
  onmouseover: function(element) {
    this.showToolTip(element, "Click to show details.");
  },
  
  showToolTip: function(element, text) {
    var offset = this.getOffsetFromBody(element);
    var tooltip = new ToolTip(text);
    tooltip.show(offset.left + 10, offset.top + 10);
  }
});

See Also