Muka surat asas
Jika halaman web anda mempunyai banyak kandungan, anda perlu menggunakan fungsi paging.
Untuk mencipta fungsi paging asas, anda perlu menambah kelas <ul>
pada elemen .pagination
:
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> <p>.pagination 类提供了分页链接:</p> <ul class="pagination"> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> </ul> </body> </html>
Jalankan Instance»
Klik butang "Run Instance" untuk melihat contoh dalam talian
Halaman semasa
boleh ditambah untuk <li>
dengan .current
Kelas untuk menandakan halaman semasa:
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> <p>当前页面需要添加 .current 类:</p> <ul class="pagination"> <li class="current"><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> </ul> </body> </html>
Jalankan Instance»
Klik butang "Jalankan Instance" untuk melihat Contoh dalam talian
Lumpuhkan paging
Jika anda perlu menetapkan halaman supaya tidak boleh diklik, anda perlu menggunakan .unavailable
kelas:
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> <p>如果要设置当前分页不可用可以使用 .unavailable 类:</p> <ul class="pagination"> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li class="unavailable"><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> </ul> </body> </html>
Run instance»
Klik butang "Run instance" untuk melihat dalam talian contoh
Arah halaman
Tambahkan kelas .arrow
pada kod pertama dan terakhir><li> untuk memasukkan simbol entiti HTML «
dan »
untuk mencipta simbol arah penomboran:
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> <p>使用 .arrow 类来创建方向符号:</p> <ul class="pagination"> <li class="arrow"><a href="#">«</a></li> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li class="arrow"><a href="#">»</a></li> </ul> </body> </html>
Run Instance»
Klik butang "Run Instance" untuk lihat contoh dalam talian
Paparan tengah halaman
Kita boleh menambah elemen <div>
dalam lapisan luar <ul> dan menambah kelas <div>
pada .pagination-centered
untuk mencapai penomboran dan paparan tengah
:
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> <p>分页居中可以 在 ul 外层添加 div 并使用 pagination-centered 类 :</p> <div class="pagination-centered"> <ul class="pagination"> <li class="arrow"><a href="#">«</a></li> <li class="current"><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li class="arrow"><a href="#">»</a></li> </ul> </div> </body> </html>
Run Instance»
Klik butang "Run Instance" untuk melihat contoh dalam talian
Breadcrumbs
Breadcrumbs digunakan untuk memaparkan struktur navigasi halaman semasa.
Tambah kelas <ul>
pada elemen .breadcrumbs
untuk melaksanakan navigasi serbuk roti. Anda boleh menambah kelas .current
atau .unavailable
pada <li> untuk menetapkan halaman semasa dan kesan tidak boleh diklik:
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> <p>.breadcrumb 类用于展示面包屑导航:</p> <ul class="breadcrumbs"> <li><a href="#">Home</a></li> <li><a href="#">Private</a></li> <li class="unavailable"><a href="#">Pictures</a></li> <li class="current">Vacation</li> </ul> </body> </html>
Jalankan Instance»
Klik butang "Run Instance" untuk melihat contoh dalam talian
Sub-navigasi
Sub-navigasi sangat berguna apabila menukar halaman.
Tambah kelas <dl>
pada elemen .sub-nav
untuk mencipta sub-navigasi. Tambahkan tajuk pada elemen <dt>
dan tambahkan kelas <dd>
untuk pilihan yang dipilih .active
:
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> <ul class="sub-nav"> <dt>Filter:</dt> <dd class="active"><a href="#">All</a></dd> <dd><a href="#">Active</a></dd> <dd><a href="#">Pending</a></dd> <dd><a href="#">Suspended</a></dd> </ul> </body> </html>
Jalankan instance »
Klik butang "Run Instance" untuk melihat contoh dalam talian