The Foundation drop-down menu allows the user to select a value from a predefined drop-down list: 尝试一下 » Using buttons or links id The value needs to match the contents of the drop-down menu (id01). In < div >, < nav > Finally, initialize the Foundation JS. 注意: On the small screen, the width of all drop-down menus is 100%. 使用 注意: On the small screen, the width of all drop-down menus is 100%. 尝试一下 » Can be used 尝试一下 » < div > add multimedia elements to the drop-down menu: 尝试一下 » By default, the drop-down menu is at the bottom, and you can add 尝试一下 » By default, the drop-down menu is displayed after the button is clicked. If you need to display after the mouse is moved up, you can use it on the button 尝试一下 » We can add it to the button 8.13.1. Example ¶
<!-- Trigger the Dropdown -->
<a href="#" data-dropdown="id01" class="button dropdown">Dropdown
Button</a>
<!-- Dropdown content -->
<ul id="id01" data-dropdown-content class="f-dropdown">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
<!-- Initialize Foundation JS -->
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>
Case analysis ¶
.dropdown
Class to add a downward arrow symbol icon to the button.
data-dropdown="id"
Property to open the drop-down menu.
<ul>
Add in
.f-dropdown
Class and
data-dropdown-content
Property to create the contents of the drop-down menu.Drop-down menu size ¶
.tiny
,
.small
,
.medium
,
.large
或
.mega
来修改下拉菜单的宽度。 8.13.2. Example ¶
<!-- Tiny Dropdown: max-width is 200px -->
<ul id="id01" data-dropdown-content class="f-dropdown tiny">..
<!-- Small Dropdown: max-width is 300px -->
<ul id="id02" data-dropdown-content class="f-dropdown small">..
<!-- Medium Dropdown: max-width is 500px -->
<ul id="id03" data-dropdown-content class="f-dropdown medium">
<!-- Large Dropdown: max-width is 800px -->
<ul id="id04" data-dropdown-content class="f-dropdown large">..
<!-- Mega Dropdown: 100% width -->
<ul id="id04" data-dropdown-content class="f-dropdown mega">..
Drop-down menu margin ¶
.content
Class to add an inner margin to the drop-down menu 8.13.3. Example ¶
<!-- Default Dropdown -->
<ul id="id01" data-dropdown-content class="f-dropdown">..
<!-- Dropdown with padding -->
<ul id="id02" data-dropdown-content class="f-dropdown content">..
Other instances ¶
8.13.4. Example ¶
<a href="#" data-dropdown="id01" class="button dropdown">Dropdown
Button</a>
<div id="id01" data-dropdown-content class="f-dropdown medium content">
<h4>Paris Title</h4>
<p>Some text.. some text..</p>
<img src="paris.jpg" alt="Paris" width="400" height="300">
<p>Paris, je t'aime.</p>
</div>
Drop-down menu direction ¶
data-options="align:left|right|top"
To change its orientation: 8.13.5. Example ¶
<a href="#" data-dropdown="id01" data-options="align:right"
class="button dropdown">Right</a>
<a href="#" data-dropdown="id02" data-options="align:top" class="button
dropdown">Top</a>
<a href="#" data-dropdown="id03" data-options="align:bottom"
class="button dropdown">Bottom</a>
<a href="#" data-dropdown="id04" data-options="align:left" class="button
dropdown">Left</a>
Pull-down menu trigger condition ¶
data-options="is_hover:true"
Attributes: 8.13.6. Example ¶
<a href="#" data-dropdown="id01" data-options="is_hover:true"
class="button dropdown">Hover over me</a>
<ul id="id01" data-dropdown-content class="f-dropdown">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
Split button ¶
.split
Class to set a split effect button, which generates a downward icon button on the < span > element: 8.13.7. Example ¶
<button class="button split">Split Button
<span data-dropdown="id01"></span>
</button>
<ul id="id01" data-dropdown-content class="f-dropdown">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
<!-- Initialize Foundation JS -->
<script>
$(document).ready(function() {
$(document).foundation();
})
</script>