【发布时间】:2012-07-14 16:09:11
【问题描述】:
总结:实现了 JQuery 选项卡。只是想为选项卡添加效果。
HTML 代码:
<div id=tabs >
<ul>
<li><a href="#div1"><span>Div1</span></a></li>
<li><a href="#div2"><span>Div2</span></a></li>
<li><a href="#div3"><span>Div3</span></a></li>
</ul>
<div id=div1 ></div>
<div id=div2 ></div>
<div id=div3 ></div>
</div>
JQuery 代码:
$(document).ready(function() {
$("#tabs").tabs();
});
这可以很好地实现选项卡 GUI 并创建选项卡式界面。 我现在想实现一个效果。 例如'blind','bounce','clip','drop','explode','fold','highlight','puff','pulsate','scale','shake','size','slide ', '转移'。
我该怎么做?从我读过的文档中:
$("#tabs").tabs(
//here is where there should be implementation of the effect
"#div1",{effect:'explode'}
"#div2",{effect:'explode'}
"#div3",{effect:'explode'}
);
});
这段代码对进一步的动画没有任何建设性的作用。
试过了
$("#div1"){effect:'effectname' 'effectproperties' }
但这也是无效的。
他们从文档中提供的一个确实有效的例子:
$("#tabs").tabs(
//here is where there should be implementation of the effect
{ fx: { opacity: 'toggle' } }
);
【问题讨论】:
-
您的标记无效;你需要一个
ul或ol在那些li周围。 -
@John 看起来设置效果的正确等待是
$('#tabs').tabs('option', 'fx', { effect : 'explode });——尽管我可能是错的。 -
{fx: {opacity: 'toggle'}}确实有效,我确实检查过。您需要考虑一下自己在做什么:转出一个标签,转入另一个标签。您正在尝试处理这两个操作吗? -
你也可以看看here
-
@Stano - 问题是在 jQuery.ui 中使用
effects系统。没那么简单,opacity演示的效果确实有效。但是$.tabs()不像explode那样处理effects。
标签: jquery jquery-ui jquery-ui-tabs jquery-effects