You can also try this one if u need it in almost all places in the page.
U can configure it in a general way then just use it.
In this way u can also use HTML element and anything u want :)
$(document).ready(function()_x000D_
{_x000D_
var options =_x000D_
{_x000D_
placement: function (context, source)_x000D_
{_x000D_
var position = $(source).position();_x000D_
var content_width = 515; //Can be found from a JS function for more dynamic output_x000D_
var content_height = 110; //Can be found from a JS function for more dynamic output_x000D_
_x000D_
if (position.left > content_width)_x000D_
{_x000D_
return "left";_x000D_
}_x000D_
_x000D_
if (position.left < content_width)_x000D_
{_x000D_
return "right";_x000D_
}_x000D_
_x000D_
if (position.top < content_height)_x000D_
{_x000D_
return "bottom";_x000D_
}_x000D_
_x000D_
return "top";_x000D_
}_x000D_
, trigger: "hover"_x000D_
, animation: "true"_x000D_
, html:"true"_x000D_
};_x000D_
$('[data-toggle="popover"]').popover(options);_x000D_
});
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>_x000D_
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>_x000D_
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>_x000D_
_x000D_
_x000D_
<div class="container">_x000D_
<h3>Popover Example</h3>_x000D_
<a id="try_ppover" href="#" data-toggle="popover" title="Popover HTML Header" data-content="<div class='jumbotron'>Some HTML content inside the popover</div>">Toggle popover</a>_x000D_
</div>
_x000D_
For setting more options, u can go here.
Even more can be found here.
If u want the popup after click, u can change the JS option to trigger: "click"
like this-
return ..;
}
......
, trigger: "click"
......
};
U also can customize it in HTML ading data-trigger="click"
like this-
<a id="try_ppover" href="#" data-toggle="popover" data-trigger="click" title="Popover Header" data-content="<div class='jumbotron'>Some content inside the popover</div>">Toggle popover</a>
I think it will be more oriented code and more re-usable and more helpful to all :).