jquery - Keep tooltip inside of parent container -
i using jquery ui tooltip in web app. default position of tooltip bottom-left of 'tool-tipped element'. however, when tooltip not fit in browser window, switches bottom right.
this behavior great, rather determining whether position tooltip bottom right or bottom left based on width of browser window, determine based on width of parent container, tooltips not display outside of area determine.
please note aware of how control position manually api, looking away control logic of positioning globally.
$(function() { $( '#bodyinner' ).tooltip(); });
you can achieve related positioning of tooltip using position
option in jquery ui tooltip. jquery ui position option contain many further options such my
, at
etc. once such option within
. can used limit position of element within another.
here, tooltips position can contained within parent element initializing tooltip follows.
$( '#bodyinner' ).tooltip({ position:{ within: "#bodyinner"} });
here demo.
Comments
Post a Comment