You can achieve anything related to positioning of tooltip using the position
option in the jQuery UI Tooltip. The jQuery UI Position option contain many further options such as my
, at
etc. Once such option is within
. This can be used to limit the position of an element within another.
Here, the tooltips position can be contained within the parent element simply by initializing the tooltip as follows.
$( '#bodyInner' ).tooltip({
position:{ within: "#bodyInner"}
});
Here is the Demo.