twitter bootstrap drop down suddenly not working

后端 未结 14 1193
半阙折子戏
半阙折子戏 2020-11-28 22:18

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 layout

相关标签:
14条回答
  • 2020-11-28 22:57

    See Rails 3.1 Assets - Strange Serving in Development

    there is a bug where the compressed version is being included in debug mode in application.js

    0 讨论(0)
  • 2020-11-28 22:58

    I had this error and it turns out my CSS was preventing the dropdown to work.

    Specifically I had 'overflow: hidden;' in my header nav CSS . Removing that solved the issue.

    0 讨论(0)
  • 2020-11-28 22:59

    Precompiling the assets again fixed the problem for me

    0 讨论(0)
  • 2020-11-28 22:59

    Precompiling assets did not work. Putting dropdown before jquery worked in development but not in production Removing dropdown still worked in development :-O

    Putting the right order and removing everything in public/assets folder made it work in development.

    0 讨论(0)
  • 2020-11-28 23:05

    I had this problem too...and it was related to rails turbolinks. On initial page load the drop downs would not work, but after a refresh they would. And, this is because with turbo links some Dom elements might not get loaded/reloaded every time. So, my drop down stopped working consistently (among other things). The rails 4 fix for this is to add the jquery.turbolinks gem https://github.com/kossnocorp/jquery.turbolinks. One thing with this gem that I found (and later came across in some blog) is that the javascript tag must be inside the head. The README does not mention this...but

    0 讨论(0)
  • 2020-11-28 23:06

    I don't understand this, but reordering //= require jquery and //= require bootstrap has seemed to fix the problem twice for me. First moving bootstrap above jquery as Sasha suggests fixed it. Then I did more work and prepared to deploy using jruby on rails 3.2.3. Precompile assets, warble, and the dropdowns quit working both in development and production. Delete public/assets, as well as some .class files and files in tmp. No effect. Finally I moved the order in application.js back to what it had been before the last failure episode, i.e. jquery before bootstrap, and dropdowns work again.

    Could an alteration to application.js be triggering a rebuild of some cache, or some process behind the scenes that is the source of the problem? Next time this happens, I will try a trivial change to application.js and see if that does anything.

    0 讨论(0)
提交回复
热议问题