0

Hi Sorry for the long winded question title,

I have multiple instance of mmenu on a page, 3x to be exact. Basically when one is open I need to be able to open another. This works but Im getting a flash of white content when I do so.

What I really want to do is to delay firing the second until after first has closed.

I have successfully set up delays using setTimeout or CSS transition and an if else statement but because the mmenu function is also called outside of the if/else it just fires as soon as I click on the anchor to trigger it.

I'm relatively new to javascript/jquery but I'm sure there is a way to get this done.

    $("#open-menu").mmenu({
        offCanvas: {
            position: "right",
            zposition: "front"
        }
    });

    $("#new-menu").mmenu({

        classes: "mm-fullscreen",
        offCanvas: {
            position: "left",
            zposition: "front"
    }

                    });


    $(".close-menu").click(function() {
         $("#new-menu, #open-menu").trigger("close.mm");
});

Excuse any sloppy code. This is the basic setup.

4

2 回答 2

0

对不起,我误解了提示。你也许正在寻找这样的东西。

$("#nav")
         .mmenu()
         .on( "closed.mm", function() {
            alert( "The menu has just been closed." );
         })
         .trigger( "close.mm" );

这是更多信息jQuery.mmenu

于 2014-10-15T12:27:09.713 回答
0

谢谢丹尼尔,

我设法解决了这个问题。

$(".button").click(function(){

        if( $("#open-menu").hasClass("mm-current")){                

            setTimeout(function(){

                $("#new-menu").addClass("unhide").mmenu({

                                classes: "mm-fullscreen",
                                offCanvas: {
                                    position: "left",
                                    zposition: "front"
                                }

                            })

                            .trigger( "open.mm" );

            }, 500);

        }

    })
于 2014-10-15T17:19:41.623 回答