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

Automatically close / collapse menu if not hovered over after a certain time

1 Answer 87 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Chris Haas
Top achievements
Rank 1
Chris Haas asked on 04 Feb 2011, 01:20 AM
Hello,

I'm using the RadMenu as the main navigation menu in my website.  If a user clicks / opens a menu item and then moves their mouse off the menu, I would like the menu to automatically close after a certain configurable time span (ie, 2 seconds).  Is this functionality built in to the control?

Thanks,
Chris

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Feb 2011, 12:45 PM
Hello Chris,

As far as I know there is no built in method to achieve the same. You can achieve the same functionality by subscribing the OnClientMouseOver event and from there you can call the setTimeOut function with desired time delay.

javascript:
<script type="text/javascript">
  var menuItem;
    function OnClientMouseOver(Sender, args)
    {
        menuItem=args.get_item();
        setTimeout("CloseMenu()", 2000);//set the time duration here
    }
    function CloseMenu()
    {
        menuItem.close();
    }   
</script>

Here is the corresponding RadMenu:
<telerik:RadMenu ID="RadMenu1"  runat="server OnClientMouseOver="OnClientMouseOver">
            <Items>
             . . . . . . . . . . .


Thanks,
Princy.
Tags
Menu
Asked by
Chris Haas
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or