Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

How do I set bootstrap tooltip placement to "Top-right" of target element? Currently, it only have "Top, Bottom, Left, Right" options. I am trying to show tooltip on the long width textbox and I need to display tooltip to the top-rigth and right align with the target control (i.e Right end of the tooltip must be same as right end of the control). I couldn't find any solution yet. Is there any advanced plugin to serve this purpose?

Please advice,
Thanks in advance
Posted
Comments
Member 11148158 22-Oct-14 2:15am    
.popover {
top: 71px !important;
left: 379px !important;
}

1 solution

XML
include these files

<pre lang="xml">&lt;script src=&quot;bootstrap-tooltip.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;bootstrap-tooltip-extension.js&quot;&gt;&lt;/script&gt;</pre>




CSS
.tooltip.top-left .tooltip-arrow {
  bottom: -5px;
  left: 5px;
  border-width: 5px 5px 0;
  border-top-color: black;
}
.tooltip.top-right .tooltip-arrow {
  bottom: -5px;
  right: 5px;
  border-width: 5px 5px 0;
  border-top-color: black;
}
.tooltip.bottom-left .tooltip-arrow {
  top: -5px;
  left: 5px;
  border-width: 0 5px 5px;
  border-bottom-color: black;
}
.tooltip.bottom-right .tooltip-arrow {
  top: -5px;
  right: 5px;
  border-width: 0 5px 5px;
  border-bottom-color: black;
}


XML
<h4 id="top-left" data-toggle="tooltip" data-placement="top-left" data-original-title="Tooltip on top left">Top Left</h4>
  <script type="text/javascript">
    $('#top-left').tooltip('show');
  </script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900