bootstrap dropdown open on pageload

后端 未结 2 1324
时光取名叫无心
时光取名叫无心 2021-01-21 14:23

Ive got this dropdown styled with bootstrap:

  • 相关标签:
    2条回答
    • 2021-01-21 14:30

      The dropdown is toggled with having the additional class 'open' added to the enclosing <li> element. So if you want to have it open on page loading:

      <li class="dropdown open">
      

      That will do the trick.

      0 讨论(0)
    • 2021-01-21 14:39

      This little bit of jQuery script (I'm assuming you've loaded it becasue you're using Bootstrap) ought to do the trick. Once the DOM has loaded, it sends a click() to the dropdown toggle button.

      $(document).ready(function () {
          $("#posuvnik").click();
      });
      

      There is probably a way to do it in straight CSS, but without seeing more of your code it's hard to know.

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