只需再次切换或使用DOCS中所述的切换:
$( "#myDiv" ).toggle( "puff" );
如果要将不透明度更改为 50%,而不是全部返回不透明:
// 50% opacity
$("#myDiv").animate({'opacity': 0.5});
//return to normal
$("#myDiv").animate({'opacity': 1});
编辑:
你需要类似的东西DEMO
有兴趣的话,puff的代码是:
$.effects.effect.puff = function( o, done ) {
var elem = $( this ),
mode = $.effects.setMode( elem, o.mode || "hide" ),
hide = mode === "hide",
percent = parseInt( o.percent, 10 ) || 150,
factor = percent / 100,
original = {
height: elem.height(),
width: elem.width(),
outerHeight: elem.outerHeight(),
outerWidth: elem.outerWidth()
};
$.extend( o, {
effect: "scale",
queue: false,
fade: true,
mode: mode,
complete: done,
percent: hide ? percent : 100,
from: hide ?
original :
{
height: original.height * factor,
width: original.width * factor,
outerHeight: original.outerHeight * factor,
outerWidth: original.outerWidth * factor
}
});
elem.effect( o );
};
您可以将其更改为不隐藏元素,但我现在不能那么快。