Display on hover, else close

2 posts, 0 answers
  1. Darren
    Darren avatar
    72 posts
    Member since:
    Oct 2006

    Posted 25 Oct 2007 Link to this post

    Hi, is it possible to display the tooltip when hovering over a link - without it fading away - until I move the mouse away off of the link?

    Currently, if I have Sticky="True" then the tooltip displays when i mouseover AND when i mouse out somewhere else. If I then move the cursor back over the link then the tooltip will flash open and then close.

    If I set Sticky="False" then when I mouseover the link it will open the tooltip and then close it. If I chane the delay then the delay value works, but if I move the cursor off of the link then the tooltip doesn't disappear until the dealy is finished.

    I'm not sure if I am using this correctly or not. Thanks.

    <a id="lnkAbstract" href="#"><img src="images/question.gif" /></a>

    <telerik:RadToolTip runat="server" ID="rttAbstract" Skin="Web20Green" Width="300px"

    TargetControlID="lnkAbstract" IsClientID="true" Animation="Fade" Sticky="true"

    RelativeTo="Element" Position="BottomCenter">

    </telerik:RadToolTip>

     
  2. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 29 Oct 2007 Link to this post

    Hello Darren,

    We implemented a simple solution for you based on the tooltip events, as well as using the onmouseout event handler of the target element to detect when the mouse leaves it. It is not a general solution but it does provide you with all the necessary bits to implement it in your own scenario:

    <script> 
            var toHide = false;       
            function OnBeforeShow(sender, args)  
            {  
                toHide = false;  
            }  
              
            function OnBeforeHide(sender, args)  
            {  
                if (!toHide) args.set_cancel(true);  
            }  
              
            function OnTargetMouseOut()  
            {  
                toHide = true;  
            }  
            </script> 
              
            <href="#" onmouseout="OnTargetMouseOut()" id="link1">I am a link</a> 
            <telerik:RadToolTip runat=server   
            ID="RadTooltip1"   
            TargetControlID="link1" 
            IsClientID="true" 
            Text="I am a tooltip"    
            HideDelay=0       
            OnClientBeforeShow = "OnBeforeShow" 
            OnClientBeforeHide="OnBeforeHide">    
            </telerik:RadToolTip> 
             


    Best wishes,
    Tervel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top