craigsworks.com - Support Forum

Full Version: how to access api callbacks?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, first of all thanks for the nice plugin.

I was trying to get something done before tooltip is shown, but couldn't access the api.

var tooltip = $('[tooltip]').qtip("api");

tooltip.qtip({
onShow: function(event){
console.log("anything");
},
content: 'Any content',
style: 'cream',
})

i assumed that accessing api should be something like above, because i could not find any example in the site. Here i want to write "anything" to firefox's console, but no luck.

Can someone correct me?

Thanks in advance.
Sinan.
I'm confused as to what you're trying to do exactly? Simply specify an onShow callback within the tooltip? IF so, you do this at runtime within your options object:

JS Code
$('[tooltip'].qtip(
{
   api: {
      onShow: function(){ console.log('anything') }
   }
});
Actually I was trying to do exactly what you have shown.

When I have seen that line below in documentation part, i was little bit confused with your syntax.

"var api = $(mytooltip).qtip("api"); // Access the API via the tooltip"

Now it is clear, thanks.
Reference URL's