www.webdeveloper.com
Results 1 to 3 of 3

Thread: Adding Delay to ToolTip

  1. #1
    Join Date
    Mar 2012
    Posts
    2

    Adding Delay to ToolTip

    Hello

    I need add delay to my HideToolTip function. This codes showing hover menu when user onmouseover on the row of my GridView. I need Hide tooltip after 500ms when user onmouseout.

    Any help?

    I tried to add this codes

    Code:
    HideToolTip: function () {
                            var pnl = $get(this.get_PanelID());
                            pnl.style.visibility = "hidden";
                            pnl.style.display = "none";
                             
    
                        },
    
     timeMsg: function () {
    
                            var t = setTimeout("HideToolTip()", 500);
                            
                }
    
    
    
    //my gridview on row data bount event is
        protected void gvHrEmploye_RowDataBound(object sender, GridViewRowEventArgs e)
        {
    
            
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int diaid = Convert.ToInt32(gvAll.DataKeys[e.Row.RowIndex].Value);
    
                e.Row.Attributes.Add("onmouseover", "tooltip.BeginShowToolTip(event," + diaid + ") ");
                e.Row.Attributes.Add("onmouseout", "tooltip.HideToolTip(timeMsg)");
               
            }
    
        }
    but no luck

    here is my full tooltip whic founf on the net.

    Code:
    <script type="text/javascript" id="hover.details">
         Type.registerNamespace("Demo");
    
         Demo.ToolTip = function (panelid) {
             this._panelid = panelid;
             this.x = 0;
             this.y = 0;
         }
    
         Demo.ToolTip.prototype =
                    {
                        get_PanelID: function () {
                            return this._panelid;
                        },
    
                        set_PanelID: function (panelid) {
                            this._panelid = panelid;
                        },
    
    
    
    
                        BeginShowToolTip: function (event, diaid) {
                            
    
                            WebService.GetToolTipText(diaid, this.EndShowToolTip, this.OnError, this.OnTimeOut);
    
                            this.x = 770;
                            this.y = event.clientY - 200;
    
    
                        },
    
                        EndShowToolTip: function (result) {
                            var pnl = $get(tooltip.get_PanelID());
                            if (pnl.innerHTML != null) {
                                pnl.innerHTML = result;
                            }
                            else {
                                pnl.textContent = result;
                            }
    
                            pnl.style.visibility = "visible";
                            pnl.style.display = "inline";
                            pnl.style.position = "absolute";
                            pnl.style.left = tooltip.x + "px";
                            pnl.style.top = tooltip.y + "px";
                        },
    
                        HideToolTip: function () {
                            var pnl = $get(this.get_PanelID());
                            pnl.style.visibility = "hidden";
                            pnl.style.display = "none";
    
                        },
    
                        OnError: function (result) {
                            alert(result.get_message());
                        },
    
                        OnTimeOut: function (result) {
                            alert(result);
    
    
                        }
                    }
    
         Demo.ToolTip.registerClass("Demo.ToolTip");
        </script>

  2. #2
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    I'm just glancing over this, so I'm not sure this is even the problem, but I've found setTimeout doesn't work in some instances unless you use the full syntax, like:

    setTimeout(function() {HideToolTip(); }, 500);

  3. #3
    Join Date
    Mar 2012
    Posts
    2

    Thank you for reply

    but tried this codes. did not work.

    Thanks again.

    Ímer

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles