jQWidgets Forums

jQuery UI Widgets Forums Navigation Menu, Context Menu How to programatically dismiss a dropdown menu item

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author

  • michaelwur
    Participant

    Hi,
    I tried to use the dropdown menu widget (jqxMenu). When a menu item is clicked, a separate browser window (or tab) is opened. But, the dropdown menu is not dismissed automatically.

    Is there a way to dismiss the clicked dropdown menu item programmatically?

    Thanks in advance!
    Michael


    Peter Stoev
    Keymaster

    Hi Michael,

    What do you mean by dismiss automatically? The Menu’s are closed automatically when the mouse cursor leaves the menu.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    michaelwur
    Participant

    Hi Peter,
    When the menu item is clicked, I use jquery JavaScript code to open a separate tab to show a different page. (The page on the original tab is not refreshed. Just onclick event code is executed to open a separate tab.) After that, I click on the original tab, the mouse cursor is still on the menu item just clicked. I need to manually move the mouse cursor out of the menu item so that the dropdown menu close automatically. I would like to have the dropdown menu close automatically when a menu item is clicked.

    Thanks again,
    Michael


    michaelwur
    Participant

    Hi,
    The onclick event handler is as follow:

      $('a.viewpagelink').click(function(e) {
         e.preventDefault();
    	 ...
         window.location = page_url; // open a separate browser window to show the page
      });    
    

    The current page is not refreshed because of the e.preventDefault() call. And, thus the dropdown menu is not dismissed automatically I think.

    Can anyone kindly advise a solution?
    Michael


    Peter Stoev
    Keymaster

    Hi Michael,

    It would be closed automatically after your mouse cursor leaves the menu, but if you navigate to a different page on click, I don’t see a problem.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.