backstretch 一個簡單的jQuery插件,它允許你動態調整大小,幻燈片功能的背景圖像添加到任何頁面或元素
<!DOCTYPE html> <html lang="zh-Hant"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap 101 Template</title> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js 讓 IE8 支援 HTML5 元素與媒體查詢 --> <!-- 警告:Respond.js 無法在 file:// 協定下運作 --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <h1>Hello, world!</h1> <!-- jQuery (Bootstrap 所有外掛均需要使用) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- 依需要參考已編譯外掛版本(如下),或各自獨立的外掛版本 --> <script src="js/bootstrap.min.js"></script> </body> </html>
<nav class="navbar navbar-default" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.html">育將電腦工作室</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav navbar-right"> <li><a href="index.html">首頁</a></li> <li><a href="http://ccs.tncomu.tw/index.php" target="_blank">台南社大105學期課程</a></li> <li><a href="http://ccs.tncomu.tw/modules/ccs_course/index.php?op=view_course&course_sn=5987" target="_blank">網站程式設計-PHP</a></li> <li><a href="contact_us.html">聯絡我們</a></li> <li><a href="about_us.html">關於我們</a></li> <li><a href="maps.html">電子地圖</a></li> <li><a href="youtube.html">HTML教學</a></li> </ul> </div><!-- /.navbar-collapse --> </div><!-- /.container-fluid --> </nav>
一、下載套件:
https://raw.githubusercontent.com/srobbin/jquery-backstretch/master/jquery.backstretch.min.js
將上列存至 class/backstretch/
二、引入套件:
<script src="class/backstretch/jquery.backstretch.min.js"></script>
三、設定
<script type="text/javascript"> $(document).ready(function(){ $('.top-content').backstretch([ "img/3.jpg" , "img/2.jpg" , "img/1.jpg" ], {duration: 3000, fade: 750}); }); </script>
四、HTML
<div class="top-content" style="height:560px;"> </div>
五、修正與導航的內距
style="margin-bottom:0px;"
<h1 class="text-center">聯絡我們<h1>
class="text-center" 是置中對齊
<div class="container"> </div>
<iframe src="https://docs.google.com/document/d/1-xVAMmvNq4Rbt1IhTH9y2XmMamKtOP9_qCw7QvGjWdA/pub?embedded=true"></iframe>
增加屬性 style="width:100%;height:500px;"
<div class="container"> </div>
bootstrap 文字置中:class="text-center"
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3672.3824860459044!2d120.26708981437422!3d23.009724422583535!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x346e70df506d2875%3A0x8f39feb5f0312841!2zNzEw5Y-w5Y2X5biC5rC45bq35Y2A5aSn54Gj6LevMTU46Jmf!5e0!3m2!1szh-TW!2stw!4v1471956505024" style="width:100%;height:500px;" frameborder="0" style="border:0" allowfullscreen></iframe>
style=
"width:100%;height:500px;"
<iframe width="560" height="315" src="https://www.youtube.com/embed/w70oltepxXo" frameborder="0" allowfullscreen></iframe>
<h1 class="text-center">HTML教學</h1> <div class="container text-center"> <iframe width="560" height="315" src="https://www.youtube.com/embed/w70oltepxXo" frameborder="0" allowfullscreen></iframe> </div>