SoFunction
Updated on 2025-04-07

Implementation of Bootstrap3 drop-down menu

How to use

Through data attribute

<div class="dropdown">
 <button  type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  Dropdown trigger
  <span class="caret"></span>
 </button>
 <ul class="dropdown-menu" aria-labelledby="dLabel">
  ...
 </ul>
</div>

via JavaScript

$('.dropdown-toggle').dropdown()

Whether through data attributes or JavaScript, data-toggle="dropdown" is always required

method

$().dropdown('toggle')

event

According to the time, it is divided into

$('#myDropdown').on('', function () {
 // do something…
})

The above is the implementation of the Bootstrap3 drop-down menu introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!