I'm initializing Bootstrap's popovers like this:
<!-- language: lang-js -->$(".popovers").popover({
placement: "right"
});
Occasionally, I'll want to display a popover in a specific place, so I use a data-placement
attribute on that particular element like this:
<i class="popovers fa fa-question-circle"
data-content="Some popover text."
data-placement="bottom" >
</i>
Bootstrap seems to ignore the data-placement
attribute and uses the option settings instead.
It seems to me the data-placement
attribute should override anything passed to the initialization method. I've scoured the Bootstrap 3 docs and can't find anything that confirms or denies this.
Here's a small demo:
<!-- begin snippet: js hide: true --> <!-- language: lang-js -->$(".popovers").popover({
container: "body",
trigger: "hover",
placement: "right"
});
<!-- language: lang-html -->
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" rel="stylesheet"/>
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.js"></script>
<div class="container">
<i class="popovers fa fa-question-circle"
data-content="Some popover text."
data-placement="bottom"
data-original-title="">
</i>
</div>
<!-- end snippet -->
Is the data-placement
attribute ignored when you pass in the property in JavaScript?