Closed northernlite69 closed 8 years ago
There are two options:
Use data-powertip
instead of title
.
I guess I haven't actually documented this, but PowerTip only uses title
if none of the other data sources exist (code). If it finds one of the data attributes it should ignore the title
attribute.
Example: <span data-powertip="This is the tooltip." title="Ignored">my span text</span>
Destroy the PowerTip instance when you're done with it.
Alternatively, you can use the API (docs) and call destroy()
to remove PowerTip from that element when you no longer want it there.
Example: $('#mySpan').powerTip('destroy');
Or: $.powerTip.destroy($('#mySpan'));
Thanks for the speedy reply!
I already thought about that solution. However, I am creating many PowerTips in code via "powertipjq"... how would this all play together?
Speculating, this is why I wondered if it should be an option to "ignore title"?
Can you provide an example?
I put this JSFiddle together real quick and it seems to be working as expected:
The PowerTip tooltip is running, but the title
attribute is still on the span
element. So if you hold your mouse cursor over it for an extra moment you'll see the browser-based title
tooltip over the PowerTip tooltip.
Interesting! My example is quite involved: I'm using jqCloud.js library then onClick of the tag cloud auto generated spans, I'm calling some ajax data that I then dynamically instantiate as the PowerTip content onto the span.
When this happens- just like the code example you gave- I get the title showing up in a PowerTip but I have you mouseout then mousein again to see the ajax data.
So my example is actually spread across 4 files- a mix of PHP, HTML, CSS and JS! But ultimately I'm doing this:
$($id).powerTip( {smartPlacement:true, mouseOnToPopup:true, placement:'n'} ); $($id).data('powertipjq', data); $.powerTip.hide(); $.powerTip.show($id);
However, because of deadlines, I've now scrapped the 2 tips idea for a nicer CSS solution so perhaps I should close this?
If the title is showing up then it must be preserved properly. But I might be misunderstanding. I tested it with the show()
and hide()
API calls and it still works the same for me.
It sounds like you found a solution, and I would need more to debug this further. So I'll close this issue.
If you can come up with a simplified test case or some way for me to debug it I'll take another look.
When I set title attribute, PowerTip uses it automatically. Can I turn this off so I can use the browsers default handling of that via its standard tooltip?
I want to do this because I will activate a PowerTip on click of a span, but would like a normal browser tooltip to appear before the click.
Great work! Thanks!