This is a migrated thread and some comments may be shown as answers.

Single tooltip across whole website

5 Answers 31 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 30 Jun 2015, 09:18 AM

Hi

  I want to replace every tooltip on my site with the kendo one, I also want in some places to use the 'title' of the div, or to get data dynamically using ajax. To accomplish this I have a tooltip like the below

 

$('body').kendoTooltip({
   filter: "img[data-tooltip-data], div[data-tooltip-data], [title][title!='']",

 

and content gets the content depending on the target type. I've put the tooltip on body as I want it across everything on the site. I've used a single tooltip rather than multiple tooltips, this is based on advice I've seen in the forums. 

I'm getting the problem you can see in the dojo below.

 

http://dojo.telerik.com/AmEYa

 

 The tooltip never disappears. I'm assume I'm doing something wrong here but I'm not sure how I'm meant to do this

 

thanks

Anthony

5 Answers, 1 is accepted

Sort by
0
Anthony
Top achievements
Rank 1
answered on 30 Jun 2015, 09:22 AM

Just to be clear, by "the tooltip never disappears" I mean it doesn't disappear when you move the mouse away from the target, it does disappear if you click elsewhere.

 

I did try using blur to manually hide the tooltip but it seemed to break it. It looks like the tooltip works by removing the title of the div it's on and it didn't always put it back

0
Vladimir Iliev
Telerik team
answered on 02 Jul 2015, 07:15 AM
Hello Anthony,

Current behavior is related to the CSS selector that you are using - it's working incorrectly, even when selecting elements using jQuery. In current case I would suggest to remove the check for the empty "title" attribute and make sure this attribute is rendered on the page only when there is content for it. 

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anthony
Top achievements
Rank 1
answered on 02 Jul 2015, 08:02 AM

"it's working incorrectly, even when selecting elements using jQuery"

 alert($("[title][title!='']").length)

 this returns 2, which is correct?

Removing every empty title is going to be harder than it sounds, I'm going to have to do this for >100 web pages.

Can you perhaps cancel the tooltip in the content function if title is empty?

 

Thanks

0
Accepted
Vladimir Iliev
Telerik team
answered on 02 Jul 2015, 08:38 AM
Hello Antony,

Apologise if I was not clear enough - the tooltip widget needs to set the "title" attribute on the target element to empty string when opened in order to prevent the browser from showing the native tooltip. Then on closing it restores the "title" attribute back to the original state - with current filter however the current element no longer match the selector and the "title" attribute is never restored to the original state. 

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Anthony
Top achievements
Rank 1
answered on 02 Jul 2015, 09:05 AM

That makes more sense, thanks, I understand now.

 Ok, I'll have to check for empty titles.

Tags
ToolTip
Asked by
Anthony
Top achievements
Rank 1
Answers by
Anthony
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or