2
I’m creating a popopver
where I inserted a close button. As shown below in the image:
HTML:
<div class="dropdown" style="float: right;">
<button type="button" class="btn btn-default btn-xs popover-markup" data-placement="bottom" style="margin-right: 10px">Preferências</button>
<div class="head hide">Opção do cliente <a class="close" href="#");">×</a></div>
<div class="content hide">
<div class="form-group">
<input type="checkbox" name="vehicle" class="checkbox-avatar-store"> Lojas do cliente<br>
</div>
<div class="form-group">
<input type="checkbox" name="vehicle" class="checkbox-competition"> Lojas concorrentes<br>
</div>
</div>
</div>
Jquery:
$('.popover-markup').popover({
html: true,
title: function () {
return $(this).parent().find('.head').html();
},
content: function () {
return $(this).parent().find('.content').html();
}
}).on('shown.bs.popover', function () {
var $popup = $(this);
$(this).next('.popover').find('a.close').click(function (e) {
$popup.popover('hide');
});
});
After it is closed using the method popover('hide')
, as shown in the code above, it is only possible to open again by clicking 2 times on the button Preferences. Why? Shouldn’t I open with just 1 click? How can I solve this problem?
Could you elaborate on your answer?!
– viana
Yes, try instead of using $popup.Popover('Hide'); replace with $popup.Popover('toggle'); to check if the problem continues
– rikardo_paiva
That didn’t solve.
– viana
@white add in your code the item I changed the above in the answer and see if it solves your problem
– rikardo_paiva