2016-03-12

Twitter Bootstrap - How to bind a tooltip nature to programmatically generated tooltip elements

$(document).ready(function(){

  // Bind bootstrap tooltips 
  $('body').tooltip({
    selector: '[rel=tooltip]'     
    , delay: {
      show: 50 
      , hide: 250     
    }
  });
});
 


This will bind static or dynamically generated items that contain a "rel" attribute with a "tooltip" value. 
This is an example, with a few extra options to consider.
 
 
  rel="tooltip"   
  data-original-title="This is the tooltip's main content, the text to display." 
  data-placement="top"   
  animation="true" 
  trigger="hover focus"   
  delay="0"   
>

No comments:

Post a Comment