Dustin
Dustin

Reputation: 707

How do I make qTip2 for jQuery work only on click?

I am using the qTip jQuery plugin, and want the tooltip to appear only when clicking a link or button. I have found several methods that are supposed to work, but don't seem to work in practice. Here is a jsFiddle where I tried two different methods: http://jsfiddle.net/dqkzV/2/. There is also another answer on here which claims to work, but doesn't seem to work for me (2nd method on my jsFiddle): jQuery tooltip onClick?. With both methods I tried, the tooltip still appears on mouseover, when it is only supposed to appear on click.

Upvotes: 4

Views: 6847

Answers (1)

andyb
andyb

Reputation: 43823

Your first method is just adding a qTip to the <body> when the .clickme button is clicked, although I do not understand why it seems to not be added and then sometimes appears on mouseover.

The second method is using the show syntax from qTip 1.0 but you have included qtip 2 as the library in the fiddle. The qTip 2 show API is very different.

The following should show the tooltip when the button is clicked.

JavaScript (jQuery)

$('.clickme').qtip({
    content: 'Hello 2nd Test',
    show: 'click'
});

Upvotes: 10

Related Questions