How to call javascript function using twitter loading tray?

I want to use javascript provided in Bootstrap Tritter. I checked that all .js files are listed in order.

I want to check if it works fine, therefore, after reading the docs , I understand that I need to "call" the appropriate javascript function

Using bootstrap-tooltip.js Launching a tooltip using javascript: $ ('# example'). Tooltip (options)

What can I call this function? It seems this is not enough to put the correct html, should I also call the function?

Thanks for the help!

+4
source share
1 answer

Give the HTML element the identifier example and related attributes like this:

 <p><a href="#" rel="tooltip" title="first tooltip" id="example">hover over me</a>,/p> 

In your <head> create a JavaScript <script> element, make sure jQuery is loaded, and then in jQuery add a tooltip to the element with the example id:

 <script type="text/javascript"> window.onload = function() { if(!window.jQuery) { alert('jQuery not loaded'); } else { $(document).ready(function(){ $('#example').tooltip({'placement':'top', 'trigger' : 'hover'}); }); } } </script> 

This will set up a tooltip when you hover over the #example element. Change top to left , right or bottom to change where the tooltip is placed relative to the element itself.


In case you want in the future, you can also configure popover.

+9
source

Source: https://habr.com/ru/post/1397323/


All Articles