Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

93
Views
How to make bootstrap 5 dropdown deactivate or use again when a certain breakpoint is reached

I wrote a simple resize function below but I don't know how to start, I believe bootstrap 5's js function will have this option but I can't find it.

I would like to treat this dropdown as a normal dom operation instead of dropdown components at smaller breakpoints. Thats why i need to disable the dropdown functions.

<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
    Dropdown button
  </button>
  <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Another action</a></li>
    <li><a class="dropdown-item" href="#">Something else here</a></li>
  </ul>
</div>

  function resizeFunction() {
    if ($(window).width() <= 992) {
      // disable dropdown function
    } else {
      // enable dropdown function
    }
  }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you just need to add disabled class to button

function resizeFunction() {
  if ($(window).width() <= 992) {
    // disable dropdown function
    $("#dropdownMenuButton1").addClass("disabled");
  } else {
    // enable dropdown function
    $("#dropdownMenuButton1").removeClass("disabled");
  }
}

I hope you will clear with this snippet

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!