twitter bootstrap drop down suddenly not working

后端 未结 14 1195
半阙折子戏
半阙折子戏 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 23:18

    Ticket #5145 was recently closed for this. The fix was reverted, but an application specific solution was supplied at the end, and works for me. Be sure to clear your browser cache, too.

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

    I had the same problem and I found 2 ways to fix it.

    First, let me tell you my set up: I followed the instructions at the bootstrap site, and downloaded bootstrap-dropdown.js. I put it in assets/javascripts. My application.js file looks like this:

    //= require jquery
    //= require jquery_ujs
    //= require twitter/bootstrap
    //= require_tree .
    

    Dropdowns didn't work.

    I noticed in the page source that a script tag for bootstrap-dropdown.js appeared twice: (I've removed the irrelevant stuff for brevity)

    <script type="text/javascript" src="/assets/jquery.js?body=1">
    <script type="text/javascript" src="/assets/jquery_ujs.js?body=1">
    <script type="text/javascript" src="/assets/twitter/bootstrap/bootstrap-dropdown.js?body=1">
    <script type="text/javascript" src="/assets/twitter/bootstrap/bootstrap-scrollspy.js?body=1">
    <script type="text/javascript" src="/assets/twitter/bootstrap.js?body=1">
    <script type="text/javascript" src="/assets/bootstrap-dropdown.js?body=1">
    <script type="text/javascript" src="/assets/bootstrap.js?body=1">
    

    So I removed the line //= require_tree . from application.js, restarted the server, and the dropdown worked!

    Then I put back the line //= require_tree . and instead removed the file assets/bootstrap-dropdown.js, and again it worked!

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