Giter Site home page Giter Site logo

Comments (3)

mherrera1987 avatar mherrera1987 commented on May 17, 2024

@adialbu How you solve this?

from bootstrap-5-wordpress-navbar-walker.

AlexWebLab avatar AlexWebLab commented on May 17, 2024

On Bootstrap the parent item of a dropdown menu is, by design, clickable only to open the dropdown and not as a link.

Here is the short version of why:

In Bootstrap, we use a mix of both hover and click though–hover for tooltips and popovers, clicks for dropdowns and more. What it really boils down to is user intent. The purpose of a hover state is to indicate something is clickable (underlined text) or to provide some quick information (full URL in a tooltip). The purpose of a click is to actually do something, to take an explicit action. Opening a dropdown is an explicit action and should only happen on click.

Here is the long version, explained directly from the author of Bootstrap: https://markdotto.com/2012/02/27/bootstrap-explained-dropdowns/

from bootstrap-5-wordpress-navbar-walker.

adrianwebdesign avatar adrianwebdesign commented on May 17, 2024

I solved it with the code below

<script type="text/javascript"> //Fix bootstrap dropdown parent click let clicked = 0; document.querySelector('.dropdown-toggle').addEventListener('click',(e)=>{ clicked++; if(clicked > 1 && e.target.classList.contains('show')){ location.href = e.target.href clicked = 0; } }) </script>

from bootstrap-5-wordpress-navbar-walker.

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.