代码没有显示我的PHP元素,我想知道原因。
这是我正在使用的HTML:
<div class="tablocation">
<ul class="css-tabs">
<li><a class="current" href="/wp-content/themes/blue-and-grey/uni-general.php">General</a></li>
<li><a href="/wp-content/themes/blue-and-grey/uni-courses.htm">Courses</a></li>
<li><a href="/wp-content/themes/blue-and-grey/uni-inthearea.htm">In the area</a></li>
<li><a href="/wp-content/themes/blue-and-grey/uni-sportsandfacilities.htm">Sports & facilities</a></li>
</ul>
<div class="clear"></div>
<div class="css-panes">
<div style="display:block"></div>
</div>
举第一个例子,对于uni-general.php,它不会加载,但将加载.htm的其他文件。只要它是一个PHP文档,它就不会。
还有-下面是我用来加载文档的脚本。
<script>
$(function() {
$("ul.css-tabs").tabs("div.css-panes > div", {
effect: 'ajax',
onBeforeClick: function(event, i) {
// get the pane to be opened
var pane = this.getPanes().eq(i);
// only load once. remove the if ( ... ){ } clause if
// you want the page to be loaded every time
if (pane.is(":empty")) {
// load it with a page specified in the tab's href
// attribute
pane.load(this.getTabs().eq(i).attr("href"));
}
}
});
});
</script>
如果需要,我可以提供PHP文档,但公平地说,我不认为这是问题所在。
从标准插件功能来看,它看起来并不太自定义。
只需加载您的标签$("ul.css-tabs").tabs();
使用jQueryUI,无论您拥有什么href
,都将通过选项卡中的ajax加载。
*Fetch external content via Ajax for the tabs by setting an href value in the tab links.*
http://jqueryui.com/demos/tabs/#ajax