We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ejmenu on mouseout hide the menu after some time

Hi,

When the mouseout event happens on ejmenu the menu hides immediately. It is possible to apply some delay in hiding the menu like hide after 5 or 10 seconds.

We want the menu to be displayed for some seconds even after doing mouseout of the menu.

Thanks

5 Replies

PO Prince Oliver Syncfusion Team November 18, 2016 12:08 PM UTC

Hi Balasubramanian,   
   
Thanks for contacting Syncfusion Support.   
   
Query1: When the mouseout event happens on ejmenu the menu hides immediately. It is possible to apply some delay in hiding the menu like hide after 5 or 10 seconds.   
   
Yes, it is possible to delay before hiding the menu items. To delay, you need to override the menu’s _hideAnimation function to delay before the menu element slides up. Have a look at the following code snippet.   
   
ej.Menu.prototype._hideAnimation =  function (element, anim) {   
            switch (anim) {   
                case "slideUp":   
                    $(element).attr({ "aria-hidden"true });   
                    element.delay(5000).slideUp(this.model.enableAnimation ? 100 : 0);break;   
                case "none":   
                    element.css("display""none"); break;   
            }   
            element.closest('li').removeClass('e-active e-mfocused');   
        };   
  
   
Note: The duration for delay is given in milliseconds.   
   
Refer to the Playground Sample 
   
Regards,   
Prince 



BR Balasubramanian Ramanathan November 18, 2016 12:21 PM UTC

Thank you for the reply.

Applying the delay makes the menu to stay for sometime after the timeout. But it has an issue. When we mouse out of one menu to other the previous menu has to disappear immediately. The mouse out delay has to happen only when we move out of  menu control

Please check the attached screenshot.

can we fix this too?

Thanks

Attachment: MenuOverlap_65988b78.zip


PO Prince Oliver Syncfusion Team November 21, 2016 12:24 PM UTC

Hi Balasubramanian, 

Thanks for your reply. 

Query: Applying the delay makes the menu to stay for sometime after the timeout. But it has an issue. When we mouse out of one menu to other the previous menu has to disappear immediately. The mouse out delay has to happen only when we move out of  menu control. can we fix this too? 

Yes, this is also possible. You need to override the menu’s _showAnimation function to hide all the other li elements that are previously show and stop their animation before displaying the next element. Have a look at the following code snippet. 

ej.Menu.prototype._showAnimation = function (element, anim) { 
            switch (anim) { 
                case "slideDown": 
                    element.closest("li").siblings("li").children("ul").css("display", "none"); 
                    element.stop(true, true).slideDown(this.model.enableAnimation ? 200 : 0); break; 
                case "none": 
                    element.css("display", "block"); break; 
            } 
        }; 

Refer to the Playground Sample 

Regards, 
Prince


BR Balasubramanian Ramanathan November 21, 2016 12:35 PM UTC

Thanks you. It works fine now.




PO Prince Oliver Syncfusion Team November 22, 2016 05:06 AM UTC

  
Hi Balasubramanian,   
  
Most welcome.     
     
We are glad to hear that issue has been fixed.      
Please let us know if you need further assistance on.  
     
Regards,      
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon