Bootstrap響應式表格詳解
更新時間:2017年05月23日 10:32:46 作者:ChrissZhao
這篇文章主要為大家詳細介紹了Bootstrap響應式表格的相關資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下
Bootstrap 的響應式 CSS 能夠自適應于臺式機、平板電腦和手機
下面是手機端顯示的樣式
代碼如下:
1.test.php
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>無標題文檔</title> <link type="text/css" rel="stylesheet" href="../bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="external nofollow" /> <script src="jquery-3.2.0.min.js"></script> <script src="../bootstrap-3.3.7-dist/js/bootstrap.min.js"></script> <!-- HTML5 Shim 和 Respond.js 用于讓 IE8 支持 HTML5元素和媒體查詢 --> <!-- 注意: 如果通過 file:// 引入 Respond.js 文件,則該文件無法起效果 --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> </head> <body> <h1>汽車信息</h1> <table class="table table-striped"> <thead> <tr> <th>代號</th> <th>名稱</th> <th class="hidden-xs">系列</th> <th class="hidden-xs">上市時間</th> <th class="hidden-xs">油耗</th> <th class="hidden-xs">功率</th> <th>價格</th> <th class="visible-xs-block">詳情</th> </tr> </thead> <tbody> <?php require "DBDA.class.php"; $db = new DBDA(); $sql = "select * from car"; $arr = $db->query($sql,1); foreach($arr as $v) { echo "<tr> <td>{$v[0]}</td> <td>{$v[1]}</td> <td class='hidden-xs'>{$v[2]}</td> <td class='hidden-xs'>{$v[3]}</td> <td class='hidden-xs'>{$v[4]}</td> <td class='hidden-xs'>{$v[5]}</td> <td>{$v[7]}</td> <td class='visible-xs-block'> <button type='button' class='btn btn-primary btn-xs xq' code='{$v[0]}'>詳情</button> </td> </tr>"; } ?> </tbody> </table> <!-- 模態(tài)框(Modal) --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">汽車詳細信息</h4> </div> <div class="modal-body" id="neirong"></div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">關閉</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal --> </div> <script type="text/javascript"> $(".xq").click(function(){ //顯示詳細信息 //取代號 var code = $(this).attr("code"); //查詢該汽車的所有信息 $.ajax({ url:"chuli.php", data:{code:code}, type:"POST", dataType:"TEXT", success: function(data){ var lie = data.trim().split("^"); var str = "<div>代號:"+lie[0]+"</div><div>名稱:"+lie[1]+"</div> <div>系列:"+lie[2]+"</div><div>上市時間:"+lie[3]+"</div><div>油耗:"+lie[4]+"</div><div>功率:"+lie[5]+"</div><div>價格:"+lie[7]+"</div>"; $("#neirong").html(str); //觸發(fā)模態(tài)框 $('#myModal').modal('show'); } }); }) </script> </body> </html>
2.chuli.php
<?php $code = $_POST["code"]; require "DBDA.class.php"; $db = new DBDA(); $sql = "select * from car where code='{$code}'"; echo $db->strquery($sql);
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- BootStrap學習筆記之nav導航欄和面包屑導航
- Bootstrap CSS組件之面包屑導航(breadcrumb)
- Bootstrap組件學習之導航、標簽、面包屑導航(精品)
- bootstrap響應式表格實例詳解
- Bootstrap禁用響應式布局的實現(xiàn)方法
- Bootstrap Navbar Component實現(xiàn)響應式導航
- Bootstrap開發(fā)實戰(zhàn)之響應式輪播圖
- BootStrap創(chuàng)建響應式導航條實例代碼
- 談一談bootstrap響應式布局
- bootstrap-treeview自定義雙擊事件實現(xiàn)方法
- BootStrap中關于Select下拉框選擇觸發(fā)事件及擴展
- bootstrap動態(tài)添加面包屑(breadcrumb)及其響應事件的方法
相關文章
Easy.Ajax 部分源代碼 支持文件上傳功能, 兼容所有主流瀏覽器
下面是Easy.Ajax類的初稿,如須發(fā)表,在代碼上還要修改以達到最簡,但API是不會變了2011-02-02JS構建頁面的DOM節(jié)點結構的實現(xiàn)代碼
本來想用json格式的,可是要么有重復,要么得嵌套,所以改用對象嵌套數(shù)組2011-12-12微信小程序通過點擊事件跨頁面?zhèn)鲄⒓癲ata-方法傳參(data-)的示例詳解
在?vue?中,我們可以直接在點擊事件中放入傳遞的參數(shù)進行傳參;然而微信小程序中并不適用這樣的寫法,但是微信小程序可以通過自定義屬性從而綁定參數(shù)使用,這篇文章主要介紹了微信小程序通過點擊事件跨頁面?zhèn)鲄⒁约癲ata-方法傳參(data-),需要的朋友可以參考下2023-12-12JavaScript格式化數(shù)字的函數(shù)代碼
當要格式化的數(shù)字為null、空或非數(shù)字時,返回的結果。默認為02010-11-11javascript 用函數(shù)語句和表達式定義函數(shù)的區(qū)別詳解
本篇文章主要介紹了javascript 用函數(shù)語句和表達式定義函數(shù)的區(qū)別。需要的朋友可以過來參考下,希望對大家有所幫助2014-01-01