简体   繁体   English

jQuery UI 1.9选项卡中的多个show()和hide()效果

[英]Multiple show() and hide() effects in jQuery UI 1.9 Tabs

Before jQueryUI 1.9, I was able to use the following to toggle both the opacity and height at the same time: 在jQueryUI 1.9之前,我可以使用以下命令同时切换不透明度和高度:

$('#site-tabs').tabs({
    fx: {opacity: 'toggle', height: 'toggle'},
});

Now that it was noted in the upgrade guide that fx is deprecated and to use the show() and hide() methods instead -- I can't figure out how to pass two effects to it. 现在,在升级指南中已注意到不建议使用fx ,而改用show()hide()方法-我不知道如何将两种效果传递给它。 I've tried: 我试过了:

show: [{effect: "opacity"}, {effect: "slideToggle"}] 显示:[{effect:“ opacity”},{effect:“ slideToggle”}]

to no avail. 无济于事。 Any pointers? 有指针吗? Thanks as always! 一如既往的感谢!

@Zach I know this is rather old, but I had the same issue and I just wanted to confirm that you were on to something. @Zach我知道这已经很老了,但是我遇到了同样的问题,我只是想确认一下你在做什么。

You can indeed build your own effect: 您确实可以建立自己的效果:

$.fn.slideFadeToggle  = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};

and use it like this show: { effect: "slideFadeToggle", duration: 500 } . 并像这样show: { effect: "slideFadeToggle", duration: 500 }show: { effect: "slideFadeToggle", duration: 500 }

It is explained pretty well i think in the documentation . 我认为在文档中解释得很好。

$( ".selector" ).tabs({ show: { effect: "slide", duration: 800 } })

However, i don't see how you could make that both slide AND fade given the new api. 但是,在新的api下,我看不到如何使滑动和淡入淡出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM