I want a popover to be contained within a collapsible div: http://jsfiddle.net/nathan9/qgyS7/. However, the popover seems to be limited to the extent of the div. Is there a way to prevent the clipping?
<a href="#toggle" data-toggle="collapse" data-target="#toggle" onClick="return false;">Toggle collapse</a>
<div id="toggle" class="collapse" style="background-color: yellow">
Content of collapsible div. Click for popover:
<i class="icon-info-sign" id="info"></i>
</div>
...
<script>
$('#info').popover({ html: true, placement: 'left', title: 'Popover', content: "<ul><li>The</li><li>popover</li><li>is</li><li>clipped.</li></ul>" });
</script>
To create a popover, you need to add the data-bs-toggle="popover" attribute to an element. Whereas, popover's title and its content that would display upon trigger or activation can be specified using the title and data-bs-content attribute respectively.
To create a popover, add the data-toggle="popover" attribute to an element. Note: Popovers must be initialized with jQuery: select the specified element and call the popover() method.
To make the image on hover in popover just insert an image as an HTML element to the data-mdb-content and set the data-mdb-html to true .
Using timer is always a risky business. I've used a variant of Mike Lucid that listens to the collapsible event, shown and hide.
Here is a working fiddle
The code is as follow:
$(document).ready(function(){
$('#toggle')
.on('shown', function(evnt) {
$(evnt.target).addClass('visible');
})
.on('hide', function(evnt) {
$(evnt.target).removeClass('visible');
})
;
});
If you want your collapsable to be visible on load, don't forget to add classes in and visible to your collapsable div.
Edit
Starting with Bootstrap 2.3, tooltips and popover have a new container
option. If you set the container to 'body', your tooltips and popovers will won't be clipped. Here is a working fiddle.
Hope that helps.
adding .collapse.in {overflow:visible}
seems to do the trick
http://jsfiddle.net/ZArX7/
EDIT: Above answer only worked in chrome
Here is a piece of jquery that delays adding the class.
$('#toggle_link').click(function() {
if($('#toggle').hasClass('in')){
$('#toggle').removeClass('visible');
}else{
setTimeout(function() {
$('#toggle').addClass('visible');
}, 1000);
}
});
This solution works
http://jsfiddle.net/fnP7y/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With