Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

twitter bootstrap drop down suddenly not working

i was wondering if someone could help me. my bootstrap drop down menu suddenly stopped working. i have no idea why. it was working before. i didn't touch my views my layouts views so i think the problem is not there. im pretty sure it has to do with my javascript but i dont know where its coming from.

my gem file is...

gem 'rails', '3.2.3' gem 'bootstrap-sass', '2.0.1' gem 'bcrypt-ruby', '3.0.1' gem 'faker', '1.0.1' gem 'will_paginate', '3.0.3' gem 'bootstrap-will_paginate', '0.0.5' gem 'devise' gem 'carrierwave' gem 'rmagick' gem 'delayed_job_active_record' gem 'daemons' gem 'make_voteable' gem 'admin_data' gem 'indextank' 

and my application.js is...

//= require jquery //= require jquery-ui //= require jquery_ujs //= require bootstrap-dropdown //= require bootstrap //= require_tree . 

im guessing maybe it has to do with my config files somehow?

like image 794
Sasha Avatar asked Apr 18 '12 21:04

Sasha


People also ask

Why is my bootstrap drop down not working?

Solution : The dropdown should be toggled via data attributes or using javascript. In the above program, we have forgotten to add a data attribute so the dropdown is not working. So add data-bs-toggle="dropdown" to toggle the dropdown.

How do I add a drop down menu in bootstrap?

To open the dropdown menu, use a button or a link with a class of . dropdown-toggle and the data-toggle="dropdown" attribute. The . caret class creates a caret arrow icon (), which indicates that the button is a dropdown.

Does bootstrap require jQuery?

Bootstrap 5 is designed to be used without jQuery, but it's still possible to use our components with jQuery. If Bootstrap detects jQuery in the window object it'll add all of our components in jQuery's plugin system; this means you'll be able to do $('[data-bs-toggle="tooltip"]').

What is dropdown toggle in bootstrap?

Overview. Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown JavaScript plugin. They're toggled by clicking, not by hovering; this is an intentional design decision.


2 Answers

had to move

//= require jquery 

below

//= require bootstrap 

within

application.js 
like image 123
Sasha Avatar answered Oct 03 '22 23:10

Sasha


if precompiling assets does not work try also removing precompiled assets

rake assets:clean

I found that dropdown js being loaded twice into the asset pipeline seems to open and close the dropdown menu instantly, but would work fine in Heroku/Production.

like image 36
tw airball Avatar answered Oct 04 '22 01:10

tw airball