Skip to content

Commit 2f1f95f

Browse files
committed
Merge branch 'feature/offset' into develop
2 parents 18f55ac + f55a812 commit 2f1f95f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/javascripts/jquery.tipsy.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,22 @@
3636

3737
var actualWidth = $tip[0].offsetWidth,
3838
actualHeight = $tip[0].offsetHeight,
39-
gravity = maybeCall(this.options.gravity, this.$element[0]);
39+
gravity = maybeCall(this.options.gravity, this.$element[0]),
40+
offset = maybeCall(this.options.offset, this.$element[0]);
4041

4142
var tp;
4243
switch (gravity.charAt(0)) {
4344
case 'n':
44-
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
45+
tp = {top: pos.top + pos.height + offset, left: pos.left + pos.width / 2 - actualWidth / 2};
4546
break;
4647
case 's':
47-
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
48+
tp = {top: pos.top - actualHeight - offset, left: pos.left + pos.width / 2 - actualWidth / 2};
4849
break;
4950
case 'e':
50-
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
51+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - offset};
5152
break;
5253
case 'w':
53-
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
54+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + offset};
5455
break;
5556
}
5657

@@ -272,4 +273,4 @@
272273
}
273274
};
274275

275-
})(jQuery);
276+
})(jQuery);

0 commit comments

Comments
 (0)