2009年3月27日 星期五

JQuery Tab 介紹與使用方法

有再寫網頁的人大部分都知道什麼是JQuery,
我就不再說明了...

今天要說的是Tab這一個外掛的用法











首先先是載入js和css的檔案
jquery的檔案只要1.1.3以上就都可以用了
 <script src="jquery-1.1.3.1.pack.js" type="text/javascript"></script> 
這一個是Tab的外掛
<script src="jquery.tabs.pack.js" type="text/javascript"></script> 
樣式表
<link rel="stylesheet" href="jquery.tabs.css" type="text/css" media="print, projection, screen"> 
只要在頁面輸入這一段
<script type="text/javascript">
$(function() {

$('#container').tabs({ remote: true });//container 是元件的ID
});
</script>
而在要放這一個外掛的地方輸入以下的HTML的原始碼
<div id="container-9">
<ul>
<li><a href="ahah_1.html"><span>One</span></a></li>
<li><a href="ahah_2.html"><span>Two</span></a></li>
<li><a href="ahah_3.html"><span>Three</span></a></li>
</ul>
</div>
ahah_1.html 這個是點了 One 這一個連結後他下面會顯示的頁面
ahah_2.html 這個是點了 Two 這一個連結後他下面會顯示的頁面
ahah_3.html 這個是點了 Three 這一個連結後他下面會顯示的頁面
下面還可以再加...
這樣就完成了

以下是他DEMO的網址