QTip2 - update tooltip while it is active

I am using qTip2 here and need the ability to update the contents of the tooltip while it is still active. Elements with a tooltip have a click event that performs some calculations that can change what I want to display in the tooltip.

I tried calling the destroy method and overwriting qtip2 after each recount, and it works, but only after moving the mouse and returning it.

What I want to achieve is to force the current active tooltip to redraw.

+6
source share
1 answer

If you look in the documentation , there is a β€œinstall” way to change the content:

$('.selector').qtip('option', 'content.text', 'new content'); // Preferred 

Is this what you are looking for?


Update: after testing the api parameters, they do not seem to work properly, but I found another method - here is the demo - hover over the tip for 1 second to see its change.

 // make sure you target a specific tip var qapi = $('#tip1').data('qtip'), newtip = 'new tooltip content' qapi.options.content.text = newtip; // update content stored in options qapi.elements.content.text(newtip); // update visible tooltip content qapi.redraw(); // redraw to adjust tooltip borders 
+7
source

Source: https://habr.com/ru/post/893542/


All Articles