Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking a link prevent navigate to the page #179

Open
dangelion opened this issue Mar 22, 2019 · 5 comments
Open

Clicking a link prevent navigate to the page #179

dangelion opened this issue Mar 22, 2019 · 5 comments

Comments

@dangelion
Copy link

dangelion commented Mar 22, 2019

Hi
I need to prevent that clicking on a link, it navigates to the url. I just want it opens the submenu.

I'm using version 3.0.4 with this code:

<ul id="metismenu">
   <li>
     <a href="/about" aria-expanded="false">Menu 1</a>
     <ul>
       <li>Test</li>
       <li>Test</li>
     </ul>
   </li>
   <li>
     <a href="/about" aria-expanded="false">Menu 2</a>
     <ul>
       <li>Test</li>
       <li>Test</li>
     </ul>
   </li>
 </ul>

   $("#metismenu").metisMenu({
     preventDefault: true
   });

For example: if I click "Menu 1" it navigates to the page /about instead I just want it opens the submenu. preventDefault: true seems to not working

Here a Codepen to clearly see this bug: https://codepen.io/anon/pen/LaMgJw

Some help?

@onokumus
Copy link
Owner

What is your project structure?

@dangelion
Copy link
Author

Hi @onokumus
it's this one: https://github.com/roots/sage

HTML code is inside /resources/views/partials/header.blade.php
JS code is inside /resources/assets/scripts/routes/common.js

Let me know if I answerd

@onokumus
Copy link
Owner

I don't see metisMenu in this repository.

@dangelion
Copy link
Author

dangelion commented Mar 22, 2019

@onokumus That's the third-party boilerplate I'm using, it's not mine. The code is placed where I said before.

I made a codepen https://codepen.io/anon/pen/LaMgJw where you clearly see this bug.
Let me know if helps

@dangelion
Copy link
Author

Hi @onokumus have you seen the bug in the codepen? Let me know, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants