我需要一種方法來通過從drupal輸出的html中抓取位來自動填充jquery Tab控件。誰能提供建議?現在,UI腳本變得不合時宜,並創建它自己的一組div來匹配導航。此時標籤打破。我絕不是一個JavaScript或jQuery的親所以原諒我的簡單的代碼;)自動填充jquery UI選項卡
<!DOCTYPE html>
jQuery用戶界面標籤(自動創建標籤)
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.tabs.js"></script>
<script type="text/javascript">
$(function(){
$('div.tab-body .title').each(function(i){
var Str = $(this).text();
var li = '<li><a href="#link">' + Str + '</a></li>';
$('ul.tabs').append(li);
$('ul.tabs li a').each(function(i){
$(this).attr("href", ('div' + ++i));
})
})
});
$(function(){
$('#tabs').tabs();
});
</script>
<style>
body {font: 12px/14px "Lucida Grande", Lucida, Verdana, sans-serif;padding:50px;}
.demoHeaders {width:330px;border:1px #ccc solid;padding:15px;margin-bottom:20px;}
.tab-body {padding: 15px}
</style>
</head>
<body>
<div class="demoHeaders">
The purpose of the test is to find a way to auto-populate tab navigation for jQuery UI Tabs.
This would be particularly useful for Drupal Views that are grouped according to field data.
<br /><br />
<a href="works.html">A link to regular tabs </a>
</div>
<div id="tabs">
<ul class="tabs">
<!-- TABS GO HERE -->
</ul>
<div id="tabs-1" class="tab-body">
<div class="title">Aug</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-08-31 09:00</li>
</ul>
</div>
<div id="tabs-2" class="tab-body">
<div class="title">Sept</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-09-31 09:00</li>
</ul>
</div>
<div id="tabs-3" class="tab-body">
<div class="title">Oct</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-10-31 09:00</li>
</ul>
</div>
<div id="tabs-4" class="tab-body">
<div class="title">Nov</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-11-31 09:00</li>
</ul>
</div>
<div id="tabs-5" class="tab-body">
<div class="title">Dec</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-12-31 09:00</li>
</ul>
</div>
</div>
</body>
有你在jQuery的,而不是主題層這樣一個paticular原因是什麼? – 2009-08-20 08:35:26