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.

enter image description here

please note aware of how control position manually api, looking away control logic of positioning globally.

$(function() {     $( '#bodyinner' ).tooltip(); }); 

this far have done.

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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -