Single tooltip across whole website

6 posts, 1 answers
  1. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 30 Jun 2015 Link to this post

    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

  2. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 30 Jun 2015 in reply to Anthony Link to this post

    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

  3. Kendo UI is VS 2017 Ready
  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 02 Jul 2015 Link to this post

    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!
     
  5. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 02 Jul 2015 in reply to Vladimir Iliev Link to this post

    "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

  6. Answer
    Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 02 Jul 2015 Link to this post

    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!
     
  7. Anthony
    Anthony avatar
    122 posts
    Member since:
    Jun 2013

    Posted 02 Jul 2015 in reply to Vladimir Iliev Link to this post

    That makes more sense, thanks, I understand now.

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

Back to Top
Kendo UI is VS 2017 Ready