I try to implement http://multi-level-push-menu.make.rs/ but I have issue with links.

Problematic code is here:

<li><a href="http://www.google.com">Collections</a></li>
<li><a href="http://www.google.com">Credits</a></li>

full code: http://jsfiddle.net/AWJJ4/3/

Why Collections and Credits not redirecting do external URL?

有帮助吗?

解决方案

preventItemClick option is by default set to true. Setting it to false will solve your problem.

<script>
$( '#menu' ).multilevelpushmenu({
    preventItemClick: false
});
</script>

However, it is highly recommended to use callbacks as shown below.

<script>
$( '#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;
    }
});
</script>

Updated fiddle, http://jsfiddle.net/AWJJ4/10/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top