Aug 3rd, 2010, 01:05 AM
#1
Delay SubMenu Show Time
Hi all,
I am using Asp.net menu control, how can I delay the showing of sub menu items ?
The menu is handled by Menu_HoverDynamic javascript function. I am trying to settimeout this function. But the problem is the sub menu
are shown and the root menu is getting hidden ?
Code:
var OriginalMenu_HoverDynamic=Menu_HoverDynamic;
Menu_HoverDynamic = function(t) {
sendingCel = t;
setTimeout('OriginalMenu_HoverDynamic(sendingCel)',1000);
};
Thanks in advance
Please mark you thread resolved using the Thread Tools as shown
Aug 3rd, 2010, 01:21 AM
#2
Re: Delay SubMenu Show Time
Hey Dana,
Personally, I hate the use of the setTimeOut function. Too many times I have seen the use of this lead to timing issues because code isn't executing when you think it is.
A quick step back from your question here...
Why are you wanting to delay the menu showing? Normally, you want to sub menu to show as quickly as possible?
Gary
Aug 3rd, 2010, 01:34 AM
#3
Re: Delay SubMenu Show Time
we have menu displayed in one of your client site. It was developed using Asp.Net menu control. While moving cursor on Root menu Displays Sub menu. Each Root menu has its own sub menu. Using Laptop if the customer moves diagonally little then its showing the next sub menu , which is irritating for the customer. He says, show the sub menu after a delay,while the cursor is in the root menu..
Please mark you thread resolved using the Thread Tools as shown
Aug 3rd, 2010, 01:50 AM
#4
Re: Delay SubMenu Show Time
Hey,
Okay, fair enough...
Hopefully this will help:
http://geekswithblogs.net/mnf/archiv...nus-popup.aspx
I haven't tested it, but it seems like a complete solution.
The only other suggestion, as mentioned in that post, would be to have the Menu Control react to the OnClick event, rather than the OnHover event.
Gary
Aug 3rd, 2010, 02:32 AM
#5
Re: Delay SubMenu Show Time
That one I already seen , there they override the Menu_HoverStatic function, But the sub menu is shown in Menu_HoverDynamic function. If I try to override by my self, the sub menu shows with some delay, But I am missing the root menu.
Please mark you thread resolved using the Thread Tools as shown
Aug 3rd, 2010, 02:35 AM
#6
Re: Delay SubMenu Show Time
Can you post what you have already? I can try and take look.
Gary
Aug 3rd, 2010, 05:57 AM
#7
Re: Delay SubMenu Show Time
Here is my Design code...
Code:
<%@ Control Language="vb" AutoEventWireup="false" Inherits="MobileMonitor.MenuControl" CodeFile="MenuControl.ascx.vb" %>
<script language="javascript" type="text/javascript">
function PopUpwindow(strName,strURL)
{
window.open(strName,null,strURL);
}
var sendingCel;
var outID;
var constShowDelay=700;//ms- configurable
var constDisappearDelay=800;//ms- configurable
var myVar;
var myTimeoutID;
var myNode, myData;
var ref_Menu_HoverStatic;
var ref_Menu_Unhover;
var ref_overrideMenu_HoverStatic;
//For sub menu
var ref_Menu_HoverDynamic;
var ref_overrideMenu_HoverDynamic;
// This function is called in <body onload="...">
function initMenuMouseHoverInterceptors()
{
// *** Interceptors ***
// @:: Menu_Hover
//debugger;
//handle case if no menu on the page
if((typeof(Menu_HoverStatic)!='undefined'))
{
ref_Menu_HoverStatic = Menu_HoverStatic;
Menu_HoverStatic = My_Menu_HoverStatic;
// @:: Menu_Unhover
ref_Menu_Unhover = Menu_Unhover;
Menu_Unhover = My_Menu_Unhover;
// @:: overrideMenu_HoverStatic
ref_overrideMenu_HoverStatic = Menu_HoverStatic;//corrected by skynyrd
Menu_HoverStatic = My_overrideMenu_HoverStatic;
}
if ((typeof(Menu_HoverDynamic) != 'undefined'))
{
ref_Menu_HoverDynamic=Menu_HoverDynamic;
Menu_HoverDynamic=My_Menu_HoverDynamic;
// @:: Menu_Unhover
//ref_Menu_Unhover = Menu_Unhover;
//Menu_Unhover = My_Menu_Unhover;
ref_overrideMenu_HoverDynamic=Menu_HoverDynamic;
Menu_HoverDynamic=ref_overrideMenu_HoverDynamic;
}
}
function My_Menu_HoverStatic(item)
{
My_overrideMenu_HoverStatic(item);
}
function My_overrideMenu_HoverStatic(item)
{
var node = Menu_HoverRoot(item);
var data = Menu_GetData(item);
myNode=node;
myData=data;
if (!data) return;
myVar = item;
myTimeoutID=setTimeout("My_DelayExpandMenu(myNode,myData)",constShowDelay);//COnfigurable
}
function My_DelayExpandMenu(node, data)
{
__disappearAfter = constDisappearDelay; //data.disappearAfter;
Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
}
function My_Menu_HoverDynamic(item)
{
My_overrideMenu_HoverStatic(item);
}
function ref_overrideMenu_HoverDynamic(item)
{
var node = Menu_HoverRoot(item);
var data = Menu_GetData(item);
myNode=node;
myData=data;
if (!data) return;
myVar = item;
myTimeoutID=setTimeout("My_DelayExpandMenu(myNode,myData)",constShowDelay);//COnfigurable
}
function My_Menu_Unhover(item)
{
clearTimeout(myTimeoutID);
ref_Menu_Unhover(item);
}
</script>
<DIV align="left" >
<table bgcolor="black" border="0" cellpadding="0" cellspacing="0" Width="100%" align="left" >
<tr>
<td Width="70%">
<asp:Menu ID="menuMM" runat="server" Orientation="Horizontal" Width="70%" ItemWrap="true"
DynamicMenuItemStyle-height="20px"
StaticHoverStyle-ForeColor="#FFCC00" DynamicHoverStyle-ForeColor="#FFCC00"
DynamicEnableDefaultPopOutImage="false" StaticEnableDefaultPopOutImage="false">
<StaticMenuItemStyle CssClass="menuStaticstyle"/>
<DynamicMenuItemStyle CssClass="menuDefaultstyle"/>
</asp:Menu>
</td>
<td Width="30%" align="center">
<asp:Button ID="btnLogout" BorderColor="black" CssClass="menuStaticstyle" runat="server" Text="Logout" CausesValidation="false" />
</td>
</tr>
</table>
</DIV>
And in the Code behind
Code:
Page.ClientScript.RegisterStartupScript(Me.GetType, "MyFunction", "initMenuMouseHoverInterceptors();", True)
In the Screen Shot, the
Details shall show under the vehicle, but its showing below Report
Attached Images
Please mark you thread resolved using the Thread Tools as shown
Aug 3rd, 2010, 06:24 AM
#8
Re: Delay SubMenu Show Time
I will need to take this away with me, and try this later on tonight.
I will post back if I am able to find out anything to help you.
Gary
Aug 4th, 2010, 02:55 AM
#9
Re: Delay SubMenu Show Time
Hi Dana,
I had a quick play with this last night, but I didn't really get a chance to have a proper run at it.
I will try again tonight, and keep you posted.
Gary
Aug 4th, 2010, 03:14 AM
#10
Re: Delay SubMenu Show Time
Thanks for your time Gary
Please mark you thread resolved using the Thread Tools as shown
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width