GithubHelp home page GithubHelp logo

Comments (8)

angeltcho avatar angeltcho commented on June 3, 2024

I commented the function call stopEventPropagation(e) in function itemAnchorClick.
Now I can click, but I don't know this is a correct thing to do...

from multi-level-push-menu.

adgsm avatar adgsm commented on June 3, 2024

Hi,

Each event triggers a callback, so I would rather suggest using event callback functionality, as follows.

$( '#menu' ).multilevelpushmenu({
    onItemClick: function() {
        // First argument is original event object
        var event = arguments[0],
            // Second argument is menu level object containing clicked item (<div> element)
            $menuLevelHolder = arguments[1],
            // Third argument is clicked item (<li> element)
            $item = arguments[2],
            // Fourth argument is instance settings/options object
            options = arguments[3];

        // You can do some cool stuff here before
        // redirecting to href location
        // like logging the event or even
        // adding some parameters to href, etc...

        // Anchor href
        var itemHref = $item.find( 'a:first' ).attr( 'href' );
        // Redirecting the page
        location.href = itemHref;
    }
});

If you don't need callback functionality you can comment function call stopEventPropagation(e), as you already did.

from multi-level-push-menu.

angeltcho avatar angeltcho commented on June 3, 2024

Ok thank you. Your suggestion is clearly better. Why isn't it a default setting ?

from multi-level-push-menu.

adgsm avatar adgsm commented on June 3, 2024

Can you please describe your suggestion more in details so I could consider its implementation for next release?

from multi-level-push-menu.

angeltcho avatar angeltcho commented on June 3, 2024

For example :
add a setting : redirectOnClick => true or false
add an anonymous function which would execute the code you gave me above when redirectOnClick is set to TRUE.

from multi-level-push-menu.

adgsm avatar adgsm commented on June 3, 2024

New milestone set - adding [option] in [v2.0.6] Prevent default event for item click.

from multi-level-push-menu.

zthurman avatar zthurman commented on June 3, 2024

Dude, you da man! Developing my first site and I very much appreciate this library as well as your fantastic documentation!

from multi-level-push-menu.

kushalshah210 avatar kushalshah210 commented on June 3, 2024

@adgsm Thanks, it's working for me.

from multi-level-push-menu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.