Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Docs/Interface/Tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Tips Method: constructor
* The tooltip element inside the tooltip container above will have 'tip' as classname.
* The title will have as classname: tip-title
* The text will have as classname: tip-text
* offset - (*object*: defaults to {x: 16, y: 16}) The distance of your tooltip from the mouse.
* offset - (*object*: defaults to {x: 16, y: 16}) The distance of your tooltip from the mouse. Can also accept a function as an argument for each offset (will be bound to `this`)
* fixed - (*boolean*: defaults to *false*) If set to true, the tooltip will not follow the mouse.
* windowPadding - (*object*; defaults to {x: 0, y: 0}) Allows you to reduce or expand the virtual size of the window for tip positioning. The tips will not be allowed to approach the edge of the window on any side based on this offset.
* id - (*string*: defaults to *null*) Add an `id` to the tooltip element, required for WAI-ARIA support.
Expand Down
8 changes: 5 additions & 3 deletions Source/Interface/Tips.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,15 @@ this.Tips = new Class({
tip = {x: this.tip.offsetWidth, y: this.tip.offsetHeight},
props = {x: 'left', y: 'top'},
bounds = {y: false, x2: false, y2: false, x: false},
obj = {};
obj = {},
offset;

for (var z in props){
obj[props[z]] = event.page[z] + this.options.offset[z];
offset = this.options.offset[z].call ? this.options.offset[z].call(this) : this.options.offset[z];
obj[props[z]] = event.page[z] + offset;
if (obj[props[z]] < 0) bounds[z] = true;
if ((obj[props[z]] + tip[z] - scroll[z]) > size[z] - this.options.windowPadding[z]){
obj[props[z]] = event.page[z] - this.options.offset[z] - tip[z];
obj[props[z]] = event.page[z] - offset - tip[z];
bounds[z+'2'] = true;
}
}
Expand Down