Prevent Pop-Up Menu from Immediately Hidding

Home Forums Older releases 1.0.x Prevent Pop-Up Menu from Immediately Hidding

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3024
    Stormdagger
    Participant

    I’m trying to change the main menu into a pop-up menu. I added the following to the page:

    function toggledisplay(){
    	// show the popup at left:100px;top:100px;
    	$('#main-menu').smartmenus('popupShow', '100px', '100px');
    	}
    

    I set “isPopup” to true.

    When I click my button, the ‘popupShow’ function is called and the menu displays, HOWEVER the menu immediately disappears. I’ve tracked it down to the “menuHideAll: function() “. Is there a way to keep the menu visible until one of the other actions that would normally hide the menus is triggered?

    #3026
    admin
    Keymaster

    You will need to stop the propagation of the click event for the target element that you use as a trigger for the popup – e.g. if you have a link like this:

    <a href="#" id="show-main-menu">Show popup</a>

    you would need to use something like this:

    $('#show-main-menu').click(function(e) {
    	toggledisplay();
    	e.stopPropagation();
    	e.preventDefault();
    });
    #3030
    Stormdagger
    Participant

    Thanks, Works perfectly!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Register

You will be emailed a link to set your password.

Login

Lost password?