【发布时间】:2014-05-22 16:50:27
【问题描述】:
我知道有些帖子有同样的问题,但我的有点不同。
我知道如何在元素点击时激活标签。关于它有很多答案。例如,this one。
我需要激活标签而不是点击,而是根据 GET 查询在页面加载时激活。我从 GET 查询中获取参数,然后想根据此参数激活选项卡。
<?
$type = $_GET['type'] ? $_GET['type'] : '0';
?>
<script>
$(function() {
var type = <?=$type; ?>;
if(type == 1)
{
// activate 1 tab
}
else-if(type == 2)
{
// activate 2 tab
}
else
{
// activate 2 tab
}
</script>
这只是一个例子。
所以问题是:如何在没有选择器的情况下使用tabs 方法。 〜喜欢那里:
$.tabs({
active: type
});
(这个不行)
【问题讨论】:
标签: javascript jquery jquery-tabs