RadMenu for ASP.NET

Hide a context Telerik RadMenu when the mouse moves away Send comments on this topic.
Troubleshooting > Hide a context Telerik RadMenu when the mouse moves away

Glossary Item Box

This topic shows how to hide a context Telerik RadMenu when mouse moves away.

We will use the window's setInterval( ) and clearInterval( ) methods.The context menu will hide in two seconds after the mouse is moved away. The code is as follows:

  Copy Code
<script>
  
var shouldHide = false;
  var timerID;

  function OnMouseOver(item)
  {
   
shouldHide = false;
  }

  
function SetHideTimer()
  {
   
shouldHide = false;
   timerID
= window.setInterval(HideTimer, 2000);
  }

  
function HideTimer()
  {
   
if (shouldHide == false)
   {
    
shouldHide = true;
   }
   
else
   {
    
<%=RadMenu1.ClientID%>.Hide(); //for v4.x
    
//<%=RadMenu1.ClientID%>.HideMenu(); for v3.x
    
window.clearInterval(timerID);
   }
  }
</script>

<
asp:label id="Label1" runat="server" oncontextmenu="SetHideTimer()">

oncontextmenu is a built-in java functionality which should be set for the label (server control, image, etc.) tag like shown above.