Hi,
I create a help tool-tip to appear on hovering over a button. But I have something on the UI which I would want to cause the tip to not be shown next time I hover over the button.
I call the following:
$(element).popover("hide");
However, when I hover over the button it still shows. How can I de-activate the popover?
Many Thanks.
$(element).popover('disable')
I can't seem to get this working, I'm using it in 'live' mode. I want to disable the popover during a drag and drop.
I initialise popover like this:
$(".bookingstimeline-block").popover({
live: true,
html: true,
placement: 'above'
});
Then during jQuery drag start I do this:
$(".bookingstimeline-block").popover('disable');
but it doesn't seem to work. I set a breakpoint in the enable and disable methods in twipsy but it never breaks.
Inside twipsy in the call to disable:
$.fn.twipsy.initWith = function (options, Constructor, name) {
var twipsy
, binder
, eventIn
, eventOut
if (options === true) {
return this.data(name)
} else if (typeof options == 'string') {
twipsy = this.data(name)
if (twipsy) { // this is false
twipsy[options]()
}
return this
}
Found a solution, because there are many instances of .bookingstimeline-block and twipsy initialises the jQuery data on hover, calling $(".bookingstimeline-block").popover('disable'); didn't find the data (this.data(name) above is unefined).
However, if I call $(this).popover('disable'); in the drag/resize handlers it works - passing the individual element to which popover is attached (this).
My problem with popovers was that they were being 'orphaned' (with respect to events) on an AJAX update and wouldn't hide. If the user had his cursor over a link during the AJAX update that popover would remain on screen and wouldn't go away.
I eventually resolved the problem by calling the following function just before the update:
function DisablePopovers() {
$("a[rel=popover]").popover('hide');
$("a[rel=popover]").popover('disable');
// Remove the popover DIV from the DOM
$(".popover").remove();
}
After the update I call code like your initialize code above.
Andrew M. Barfield
http://www.l33tnews.com/
$(element).popover('disable').popover("hide");
thank you AndrewBarfield,
for this line $(".popover").remove();
My problem is solve now.....
If i implement $(".popover").remove(), then the popover is not coming on clicking the element. It is coming only if i click outside and then click the element. Is there any workaround for this.
This brute-force method is what worked in my case finally. With others, after a series of toggles there were runtime errors being reported in the console. My aim was to disable to popovers from happening at all even if mouse comes over them, until another function re-initiates them.
``
$('[data-toggle="popover"]').popover('hide');
$('[data-toggle="popover"]').popover('disable');
$('[data-toggle="popover"]').popover('dispose');
````
Then to initiate again:
$('[data-toggle="popover"]').popover();`
Most helpful comment