Hello everyone! I hope someone can answer this question that should hopefully be pretty straight forward.
I have a HoverMenuExtender applied to a LinkButton. This LinkButton is just calling a javascript function to open a separate browser window and then returns false, so no postback.
When the LinkButton is clicked, the window opens and I do what I need to do there and close it. Back on the page with my LinkButton, the hovermenu is now sticked on and will stay there until I click somewhere else on the page.
Is there a way to disable the HoverMenuExtender sticking when the Target is clicked feature?
I figured something along these lines would work, but it didn't turn out to be easy. The main difficulty seems to be that the hovermenu pops on
after the javascript function I'm calling. So, any display changes I make to the hovermenu within the linkbutton's client onclick will have no effect.
The only method that worked using pure javascript was to set a timeout to hide the hovermenu. That way the hide would execute after the pop-on is executed.
This is the javascript code I ended up using. I was hoping there was a more native way to do it setting a property on the HoverMenuExtender.
var hoverPanel;
function viewMerchant(id,pnlId)
{
window.open(...code used to open window);
hoverPanel = pnlId;
window.onfocus = function(){
setTimeout('hoverOff()',1);
}
return false;
}
function hoverOff()
{
document.getElementById(hoverPanel).style.display = 'none';
}
I had this problem as well, but only in Internet Explorer. The hoverMenu was sticking after a click. In my case, it was the width attribute for the target element (which was an asp:panel) that seemed to be causing the issue. I removed the width attribute
and the Hovermenu (AKA the PopupControlID) no longer stuck when the target was clicked. IDK why this happens exactly, but if you are specifying a width for the target element, try removing it.
Edit: It may have been the fact that specifying a width was causing a javascript error. If using IE, open developer tools (F12 key) and click on script. Roll over the target and see if there are any script errors. Resolving errors in javascript may solve
the problem. (it did for me)
Storm24
0 Points
2 Posts
HoverMenuExtender setting to not stick when Target is clicked?
Feb 25, 2009 01:40 AM|LINK
Hello everyone! I hope someone can answer this question that should hopefully be pretty straight forward.
I have a HoverMenuExtender applied to a LinkButton. This LinkButton is just calling a javascript function to open a separate browser window and then returns false, so no postback.
When the LinkButton is clicked, the window opens and I do what I need to do there and close it. Back on the page with my LinkButton, the hovermenu is now sticked on and will stay there until I click somewhere else on the page.
Is there a way to disable the HoverMenuExtender sticking when the Target is clicked feature?
Thanks!
chintanpshah
All-Star
19058 Points
3273 Posts
Re: HoverMenuExtender setting to not stick when Target is clicked?
Feb 25, 2009 08:14 AM|LINK
Set the <asp:Panel> as hidden using javascript onclick event of Link Button along with you script.
Like:
var panel1 = document.getElementById('<%Panel1.ClientID%>');
panel1.style.visibility='hidden';
Hope this helps...
Don't forget to mark as answer, if this helps
My Software Website
Storm24
0 Points
2 Posts
Re: HoverMenuExtender setting to not stick when Target is clicked?
Feb 25, 2009 02:05 PM|LINK
I figured something along these lines would work, but it didn't turn out to be easy. The main difficulty seems to be that the hovermenu pops on after the javascript function I'm calling. So, any display changes I make to the hovermenu within the linkbutton's client onclick will have no effect.
The only method that worked using pure javascript was to set a timeout to hide the hovermenu. That way the hide would execute after the pop-on is executed.
This is the javascript code I ended up using. I was hoping there was a more native way to do it setting a property on the HoverMenuExtender.
var hoverPanel;
function viewMerchant(id,pnlId)
{
window.open(...code used to open window);
hoverPanel = pnlId;
window.onfocus = function(){
setTimeout('hoverOff()',1);
}
return false;
}
function hoverOff()
{
document.getElementById(hoverPanel).style.display = 'none';
}
davrob01
Member
8 Points
4 Posts
Re: HoverMenuExtender setting to not stick when Target is clicked?
Nov 21, 2012 05:54 PM|LINK
I had this problem as well, but only in Internet Explorer. The hoverMenu was sticking after a click. In my case, it was the width attribute for the target element (which was an asp:panel) that seemed to be causing the issue. I removed the width attribute and the Hovermenu (AKA the PopupControlID) no longer stuck when the target was clicked. IDK why this happens exactly, but if you are specifying a width for the target element, try removing it.
Edit: It may have been the fact that specifying a width was causing a javascript error. If using IE, open developer tools (F12 key) and click on script. Roll over the target and see if there are any script errors. Resolving errors in javascript may solve the problem. (it did for me)