Skip to content Skip to sidebar Skip to footer

Load A Twitter Bootstrap Popover On Page Load

I have the following BootStrap popover:

Solution 1:

I found this way to be convenient:

You can trigger the 'show' and set options in one fell swoop:

$('#elementToPointAt').popover({
   'placement':'bottom',
   'content':'Look at me!'
}).popover('show');

Solution 2:

You forgot the quotes for show. This works:

$(function () { 
  $("#example").popover('show');
});

Full example would be:

<!DOCTYPE html><htmllang="en"><head><linkhref="css/bootstrap.min.css"rel="stylesheet"></head><body><ahref='#'id='example'rel='popover'data-placement='right'data-content='Its so simple to create a tooltop for my website!'data-original-title='Twitter Bootstrap Popover'>HEY</a><scriptsrc="js/jquery.js"></script><scriptsrc="js/bootstrap.min.js"></script><scriptsrc="js/script.js"></script><script>
      $(function() { 
        $("#example").popover('show');
      });
    </script></body></html>

Solution 3:

Run it after window is loaded like so:

$(window).load(function(){
  $("#example").popover('show');
});

Solution 4:

$("#example").popover({'placement':'bottom'}).popover('show');

Solution 5:

$(document).ready(function(){

window.setTimeout("$('#example').popover('show')",1000);

}

It works for me. Try it out.

Post a Comment for "Load A Twitter Bootstrap Popover On Page Load"