Kotak gesaan asas
Kotak gesaan dipaparkan selepas tetikus bergerak ke atas elemen:
Kami boleh menambah atribut data-tooltip
pada mana-mana elemen untuk mencipta maklumat segera. Gunakan atribut title
untuk menetapkan teks petua alat.
Nota: Peluncur memerlukan JavaScript. Jadi anda perlu memulakan oundation JS:
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> <span data-tooltip title="php中文网">鼠标移到我这!</span> <a href="#" data-tooltip class="button" title="www.php.cn">鼠标移到我这!</a> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
Run Instance»
Klik butang "Run Instance" untuk melihat contoh dalam talian
.has-tip
kelas boleh teks tebal dialihkan oleh tetikus:
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>Tooltips</h2> <span data-tooltip title="php中文网">鼠标移到我这!</span> <span data-tooltip class="has-tip" title="php中文网">鼠标移到我这!</span> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
Jalankan instance»
Klik butang "Jalankan Instance" untuk melihat contoh dalam talian
Kedudukan paparan kotak gesaan
Secara lalai, kotak gesaan akan muncul di bahagian bawah daripada unsur tersebut.
Anda boleh menggunakan .tip-top
, .tip-left
, .tip-right
atau .tip-bottom
(lalai) untuk menetapkan kedudukan petua alat.
Nota: Pada skrin kecil, lebar jalur petua alat ialah 100%.
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>默认情况下,提示框会出现在元素的底部。</p> <p>可以使用 <code>.tip-top</code>, <code>.tip-left</code>, <code>.tip-right</code> or <code>.tip-bottom</code> (默认) 来设置提示框的位置。</p> <p><strong>注意:</strong> 在小尺寸的屏幕上,提示框的宽带是 100%。</p> <span data-tooltip class="has-tip tip-top" title="php中文网!">顶部</span> <span data-tooltip class="has-tip tip-bottom" title="php中文网!">底部</span> <span data-tooltip class="has-tip tip-left" title="www.php.cn">左边</span> <span data-tooltip class="has-tip tip-right" title="www.php.cn">右边</span> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
Run Instance»
Klik butang "Run Instance" untuk melihat contoh dalam talian
Kotak gesaan sudut bulat
.radius
dan .roun
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> <code>.radius</code> 和 <code>.round</code> 类用于设置圆角提示框:</p> <span data-tooltip class="has-tip" title="php中文网!">默认</span> <span data-tooltip class="has-tip radius" title="php中文网!">圆角</span> <span data-tooltip class="has-tip round" title="php中文网!">圆形</span> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
<> jalankan Instance»
Klik butang "Run Instance" untuk melihat contoh dalam talian
d
Kelas digunakan untuk menetapkan kotak gesaan sudut bulat: