Menu lungsur asas
Menu lungsur turun Yayasan membenarkan pengguna memilih nilai daripada senarai lungsur turun yang dipratentukan:
Instance
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div style="padding:20px;"> <h2>下拉菜单按钮</h2> <a href="#" data-dropdown="id01" class="button dropdown">Dropdown Button</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> </div> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
Jalankan Instance»
Klik butang "Run Instance" untuk melihat contoh dalam talian
Analisis Instance
.dropdown
Kelas menambah ikon simbol anak panah ke bawah" ke butang.
Gunakan atribut data-dropdown="id"
butang atau pautan untuk membuka menu lungsur turun Nilai
id perlu sepadan dengan kandungan. menu lungsur turun (id01) dalam < Tambahkan kelas
dan atribut ke div>, <nav>, <ul>
untuk mencipta kandungan menu lungsur Akhirnya, mulakan Foundation JS. :.f-dropdown
Pada skrin kecil, lebar semua menu lungsur turun ialah 100%. 🎜> Pada skrin kecil, lebar semua menu lungsur turun ialah 100%. Butang Instance" untuk melihat contoh dalam taliandata-dropdown-content
Anda boleh menggunakan kelas untuk menambah padding pada menu drop-down:
Instance
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px"> <!-- Tiny Dropdown: max-width is 200px --> <a href="#" data-dropdown="id01" class="button dropdown">Tiny</a> <ul id="id01" data-dropdown-content class="f-dropdown tiny"> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> </ul> <br> <!-- Small Dropdown: max-width is 300px --> <a href="#" data-dropdown="id02" class="button dropdown">Small</a> <ul id="id02" data-dropdown-content class="f-dropdown small"> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> </ul> <br> <!-- Medium Dropdown: max-width is 500px --> <a href="#" data-dropdown="id03" class="button dropdown">Medium</a> <ul id="id03" data-dropdown-content class="f-dropdown medium"> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> </ul> <br> <!-- Large Dropdown: max-width is 800px --> <a href="#" data-dropdown="id04" class="button dropdown">Large</a> <ul id="id04" data-dropdown-content class="f-dropdown large"> <li><a href="#">Link 1</a></li> <li><a href="#">Link 2</a></li> <li><a href="#">Link 3</a></li> </ul> <br> <!-- Mega Dropdown: 100% width --> <a href="#" data-dropdown="id05" class="button dropdown">Mega</a> <ul id="id05" data-dropdown-content class="f-dropdown mega"> <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> </body> </html>
.tiny
.small
.medium
Jalankan Instance».large
.mega
Klik butang "Run Instance" untuk melihat contoh dalam talianKejadian lain
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px"> <h2>下拉菜单内容项</h2> <a href="#" data-dropdown="id01" class="button dropdown">没有内边距</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> <a href="#" data-dropdown="id02" class="button dropdown">有内边距</a> <ul id="id02" data-dropdown-content class="f-dropdown content"> <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> </body> </html>
Jalankan Instance»
Arah menu lungsur turun.content
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px;"> <h2>下拉菜单内容</h2> <a href="#" data-dropdown="id01" class="button dropdown">下拉按钮</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> <!-- Initialize Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
Jalankan Instance»
Syarat pencetus menu lungsur
pada butang:
Instance<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px;"><br><br><!-- Add <br> elements to enable top dropdown --> <h2>下拉菜单方向</h2> <a href="#" data-dropdown="id01" data-options="align:right" class="button dropdown">右边</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> <a href="#" data-dropdown="id02" data-options="align:top" class="button dropdown">顶部</a> <ul id="id02" 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> <a href="#" data-dropdown="id03" data-options="align:bottom" class="button dropdown">底部</a> <ul id="id03" 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> <a href="#" data-dropdown="id04" data-options="align:left" class="button dropdown">左边</a> <ul id="id04" 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> </body> </html>
Jalankan contoh»
Klik butang "Jalankan contoh" untuk melihat contoh dalam talian
Butang pisah
Kami boleh menambah pada butang .split
kelas untuk menetapkan butang dengan kesan split Selepas membelah, ia akan
Hasilkan butang ikon ke bawah pada elemen <span>:
Instance
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body style="padding:20px"> <h2>下拉菜单触发条件</h2> <a href="#" data-dropdown="id01" data-options="is_hover:true" class="button dropdown">鼠标移动到我这</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> <!-- Initialize Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
Jalankan instance»
Klik Butang "Jalankan Instance" untuk melihat contoh dalam talian